a tool for shared writing and social publishing

add safe array type

I should use this in more places in the future!

+8 -12
+3
my-types.d.ts
··· 1 + type SafeArray<T> = Omit<Array<T>, number> & { 2 + readonly [index: number]: T | undefined; 3 + };
+1 -1
src/replicache/utils.ts
··· 69 69 eav<A extends Attribute>(entity: string, attribute: A) { 70 70 return initialFacts.filter( 71 71 (f) => f.entity === entity && f.attribute === attribute, 72 - ) as Fact<A>[]; 72 + ) as SafeArray<Fact<A>>; 73 73 }, 74 74 }); 75 75
+4 -11
tsconfig.json
··· 1 1 { 2 2 "compilerOptions": { 3 - "lib": [ 4 - "dom", 5 - "dom.iterable", 6 - "esnext" 7 - ], 8 - "types": [ 9 - "@cloudflare/workers-types" 10 - ], 3 + "lib": ["dom", "dom.iterable", "esnext"], 4 + "types": ["@cloudflare/workers-types"], 11 5 "baseUrl": ".", 12 6 "allowJs": true, 13 7 "skipLibCheck": true, ··· 30 24 "target": "ES2017" 31 25 }, 32 26 "include": [ 27 + "my-types.d.ts", 33 28 "next-env.d.ts", 34 29 ".next/types/**/*.ts", 35 30 "**/*.js", ··· 37 32 "**/*.tsx", 38 33 "**/*.mdx" 39 34 ], 40 - "exclude": [ 41 - "node_modules" 42 - ] 35 + "exclude": ["node_modules"] 43 36 }