diff --git a/my-types.d.ts b/my-types.d.ts new file mode 100644 index 00000000..96a33e2a --- /dev/null +++ b/my-types.d.ts @@ -0,0 +1,3 @@ +type SafeArray = Omit, number> & { + readonly [index: number]: T | undefined; +}; diff --git a/src/replicache/utils.ts b/src/replicache/utils.ts index d4a4c618..baba44f0 100644 --- a/src/replicache/utils.ts +++ b/src/replicache/utils.ts @@ -69,7 +69,7 @@ export const scanIndexLocal = (initialFacts: Fact[]) => ({ eav(entity: string, attribute: A) { return initialFacts.filter( (f) => f.entity === entity && f.attribute === attribute, - ) as Fact[]; + ) as SafeArray>; }, }); diff --git a/tsconfig.json b/tsconfig.json index c1a11c79..23ebaecd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,13 +1,7 @@ { "compilerOptions": { - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], - "types": [ - "@cloudflare/workers-types" - ], + "lib": ["dom", "dom.iterable", "esnext"], + "types": ["@cloudflare/workers-types"], "baseUrl": ".", "allowJs": true, "skipLibCheck": true, @@ -30,6 +24,7 @@ "target": "ES2017" }, "include": [ + "my-types.d.ts", "next-env.d.ts", ".next/types/**/*.ts", "**/*.js", @@ -37,7 +32,5 @@ "**/*.tsx", "**/*.mdx" ], - "exclude": [ - "node_modules" - ] + "exclude": ["node_modules"] }