Fix TypeScript errors under exactOptionalPropertyTypes
Use a local PdfJsXmpMetadata interface instead of the non-exported pdfjs Metadata type, omit undefined optional fields in reconcileFingerprint, and type discovery hook mocks with explicit DiscoveryCandidate return types.
This commit is contained in:
parent
2b613f3f99
commit
1e549dd8ff
3 changed files with 20 additions and 10 deletions
|
|
@ -20,7 +20,7 @@ export function reconcileFingerprint(
|
|||
|
||||
return {
|
||||
unchanged,
|
||||
previousFingerprint,
|
||||
...(previousFingerprint !== undefined ? { previousFingerprint } : {}),
|
||||
currentFingerprint,
|
||||
requiresReanchor: !unchanged,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import {
|
|||
reIngestAndCompare,
|
||||
recoveryStateAfterLocalSearch,
|
||||
searchCanonicalQuote,
|
||||
type DiscoveryCandidate,
|
||||
} from "./index";
|
||||
|
||||
describe("reconcileFingerprint", () => {
|
||||
|
|
@ -77,15 +78,19 @@ describe("createSourceDiscoveryRegistry", () => {
|
|||
const registry = createSourceDiscoveryRegistry();
|
||||
registry.register({
|
||||
name: "low",
|
||||
discover: vi.fn(async () => [
|
||||
{ uri: "file:///a", confidence: 0.2, source: "local" },
|
||||
]),
|
||||
discover: vi.fn(
|
||||
async (): Promise<readonly DiscoveryCandidate[]> => [
|
||||
{ uri: "file:///a", confidence: 0.2, source: "local" },
|
||||
],
|
||||
),
|
||||
});
|
||||
registry.register({
|
||||
name: "high",
|
||||
discover: vi.fn(async () => [
|
||||
{ uri: "https://example.com/doc", confidence: 0.9, source: "external" },
|
||||
]),
|
||||
discover: vi.fn(
|
||||
async (): Promise<readonly DiscoveryCandidate[]> => [
|
||||
{ uri: "https://example.com/doc", confidence: 0.9, source: "external" },
|
||||
],
|
||||
),
|
||||
});
|
||||
|
||||
const candidates = await registry.discover({ title: "Example" });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue