turn on noUncheckedIndexedAccess TS rule
Closed this issue · 1 comments
danadajian commented
When setting noUncheckedIndexedAccess
to true
in a project consuming this library, type errors ensue:
node_modules/@elysiajs/cors/src/index.ts:211:49 - error TS2345: Argument of type 'Origin | undefined' is not assignable to parameter of type 'Origin'.
Type 'undefined' is not assignable to type 'Origin'.
211 const value = processOrigin(origins[i], request, from)
~~~~~~~~~~
node_modules/@elysiajs/static/src/index.ts:107:34 - error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.
107 if (shouldIgnore(file)) continue
~~~~
node_modules/@elysiajs/static/src/index.ts:109:62 - error TS2769: No overload matches this call.
Overload 1 of 3, '(path: string | URL, options?: BlobPropertyBag | undefined): BunFile', gave the following error.
Argument of type 'string | undefined' is not assignable to parameter of type 'string | URL'.
Type 'undefined' is not assignable to type 'string | URL'.
Overload 2 of 3, '(path: Uint8Array | ArrayBufferLike, options?: BlobPropertyBag | undefined): BunFile', gave the following error.
Argument of type 'string | undefined' is not assignable to parameter of type 'Uint8Array | ArrayBufferLike'.
Type 'undefined' is not assignable to type 'Uint8Array | ArrayBufferLike'.
Overload 3 of 3, '(fileDescriptor: number, options?: BlobPropertyBag | undefined): BunFile', gave the following error.
Argument of type 'string | undefined' is not assignable to parameter of type 'number'.
Type 'undefined' is not assignable to type 'number'.
109 const response = () => new Response(Bun.file(file))
~~~~
node_modules/@elysiajs/static/src/index.ts:110:32 - error TS18048: 'file' is possibly 'undefined'.
110 let fileName = file
~~~~
node_modules/@elysiajs/trpc/src/index.ts:19:17 - error TS2339: Property 'path' does not exist on type 'ValueError | undefined'.
19 const { path, message } = [...check.Errors(value)][0]
~~~~
node_modules/@elysiajs/trpc/src/index.ts:19:23 - error TS2339: Property 'message' does not exist on type 'ValueError | undefined'.
19 const { path, message } = [...check.Errors(value)][0]
~~~~~~~
Found 6 errors in 3 files.
Errors Files
1 node_modules/@elysiajs/cors/src/index.ts:211
3 node_modules/@elysiajs/static/src/index.ts:107
2 node_modules/@elysiajs/trpc/src/index.ts:19
danadajian commented
Whoops, wrong project! :D