Open btakita opened 8 months ago
The v0.8 release fixed a couple of the type errors. I'm reopening this because there is still one type error as of v0.8.3.
✖ ../../node_modules/.pnpm/elysia@0.8.3_@sinclair+typebox@0.32.1_typescript@5.4.0-dev.20231212/node_modules/elysia/dist/types.d.ts:6:32: Type error TS2307
Cannot find module 'openapi-types' or its corresponding type declarations.
bun -b check-dts
.
I didn't find them in 1.0.0
bunx -b check-dts
✔ Check types
I have the following in the main branch (HEAD commit 8b269257ca46c5d55cb192765758105064b080f8):
➜ elysia git:(main) bun -v
1.0.33
➜ elysia git:(main) bunx -b check-dts
✖ Check types
✖ build.ts:1:10: Type error TS2305
Module '"bun"' has no exported member '$'.
✖ example/analysis.ts:1:23: Type error TS2307
Cannot find module 'benchmark' or its corresponding type declarations.
✖ src/type-system.ts:1:23: Type error TS2724
'"@sinclair/typebox"' has no exported member named 'NumberOptions'. Did you mean 'NumericOptions'?
✖ build.ts:2:37: Type error TS2307
Cannot find module 'tsup' or its corresponding type declarations.
✖ example/video.ts:4:12: Type error TS2345
Argument of type 'BunFile' is not assignable to parameter of type 'Handler<MergeSchema<UnwrapRoute<InputSchema<never>, {}>, {}>, { request: {}; store: {}; }, "/">'.
✖ example/extension.ts:5:53: Type error TS2339
Property 'extends' does not exist on type 'Elysia<"", false, { decorator: {}; store: {}; derive: {}; resolve: {}; }, { type: {}; error: {}; }, { schema: {}; macro: {}; }, {}, { derive: {}; resolve: {}; schema: {}; }, { derive: {}; resolve: {}; schema: {}; }>'.
✖ example/extension.ts:6:5: Type error TS7031
Binding element 'onBeforeHandle' implicitly has an 'any' type.
✖ example/extension.ts:6:21: Type error TS7031
Binding element 'events' implicitly has an 'any' type.
✖ test/aot/response.test.ts:9:2: Type error TS2578
Unused '@ts-expect-error' directive.
✖ example/schema.ts:63:23: Type error TS2339
Property 'meta' does not exist on type 'Elysia<"", false, { decorator: {}; store: {}; derive: {}; resolve: {}; }, { type: { readonly name: { name: string; }; readonly b: { response: number; }; readonly authorization: { authorization: string; }; }; error: {}; }, { ...; }, { ...; }, { ...; }, { ...; }>'.
✖ example/schema.ts:63:38: Type error TS2304
Cannot find name 'SCHEMA'.
✖ example/schema.ts:64:23: Type error TS2339
Property 'meta' does not exist on type 'Elysia<"", false, { decorator: {}; store: {}; derive: {}; resolve: {}; }, { type: { readonly name: { name: string; }; readonly b: { response: number; }; readonly authorization: { authorization: string; }; }; error: {}; }, { ...; }, { ...; }, { ...; }, { ...; }>'.
✖ example/schema.ts:64:38: Type error TS2304
Cannot find name 'DEFS'.
✖ example/schema.ts:65:23: Type error TS2339
Property 'meta' does not exist on type 'Elysia<"", false, { decorator: {}; store: {}; derive: {}; resolve: {}; }, { type: { readonly name: { name: string; }; readonly b: { response: number; }; readonly authorization: { authorization: string; }; }; error: {}; }, { ...; }, { ...; }, { ...; }, { ...; }>'.
✖ example/schema.ts:65:38: Type error TS2304
Cannot find name 'SCHEMA'.
✖ src/ws/types.ts:68:9: Type error TS2503
Cannot find namespace 'Bun'.
✖ src/ws/types.ts:68:9: Type error TS4081
Exported type alias 'LocalHook' has or is using private name 'Bun'.
✖ src/ws/types.ts:69:32: Type error TS2503
Cannot find namespace 'Bun'.
✖ src/ws/types.ts:69:32: Type error TS4081
Exported type alias 'LocalHook' has or is using private name 'Bun'.
✖ test/lifecycle/transform.test.ts:70:24: Type error TS2554
Expected 1 arguments, but got 2.
✖ test/core/elysia.test.ts:124:4: Type error TS2578
Unused '@ts-expect-error' directive.
✖ test/types/scoped.ts:138:50: Type error TS2344
Type '{ derive: { readonly b: "b"; }; }' does not satisfy the constraint '"Expected: ..., Actual: boolean"'.
✖ test/core/modules.test.ts:141:49: Type error TS2339
Property 'derived' does not exist on type '{ body: unknown; query: Record<string, string | undefined>; params: never; headers: Record<string, string | undefined>; cookie: Record<string, Cookie<any>>; ... 4 more ...; error: <const Code extends number | ... 59 more ... | "Network Authentication Required", const T = Code extends 100 | ... 58 more ... | 511 ? { ...'.
✖ test/types/scoped.ts:144:51: Type error TS2344
Type '{ derive: { readonly b: "b"; }; }' does not satisfy the constraint '{ derive: "Expected: ..., Actual: never"; b: "Expected: never, Actual: literal string: b"; }'.
✖ test/types/scoped.ts:144:51: Type error TS2344
Type '{ derive: { readonly b: "b"; }; }' does not satisfy the constraint '{ derive: "Expected: ..., Actual: never"; b: "Expected: never, Actual: literal string: b"; }'.
✖ test/lifecycle/transform.test.ts:225:24: Type error TS2554
Expected 1 arguments, but got 2.
✖ src/compose.ts:821:12: Type error TS2339
Property 'Default' does not exist on type 'typeof Value'.
✖ src/compose.ts:849:12: Type error TS2339
Property 'Default' does not exist on type 'typeof Value'.
✖ src/compose.ts:877:12: Type error TS2339
Property 'Default' does not exist on type 'typeof Value'.
✖ src/compose.ts:906:13: Type error TS2339
Property 'Default' does not exist on type 'typeof Value'.
✖ src/compose.ts:936:12: Type error TS2339
Property 'Default' does not exist on type 'typeof Value'.
✖ src/index.ts:4266:30: Type error TS2503
Cannot find namespace 'Bun'.
✖ src/index.ts:5208:7: Type error TS2352
Conversion of type '{ websocket: { message(ws: ServerWebSocket<any>, message: string | Buffer): void | Promise<void>; open?(ws: ServerWebSocket<any>): void | Promise<...>; ... 10 more ...; perMessageDeflate?: boolean | ... 1 more ... | undefined; }; ... 8 more ...; reusePort: boolean; } | ... 62 more ... | { ...; }' to type 'Serve' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
✖ src/index.ts:5220:7: Type error TS2352
Conversion of type '{ websocket: { message(ws: ServerWebSocket<any>, message: string | Buffer): void | Promise<void>; open?(ws: ServerWebSocket<any>): void | Promise<...>; ... 10 more ...; perMessageDeflate?: boolean | ... 1 more ... | undefined; }; ... 8 more ...; reusePort: boolean; } | ... 6 more ... | { ...; }' to type 'Serve' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
I have the following in the main branch (HEAD commit 8b26925):
➜ elysia git:(main) bun -v 1.0.33
➜ elysia git:(main) bunx -b check-dts ✖ Check types ✖ build.ts:1:10: Type error TS2305 Module '"bun"' has no exported member '$'. ✖ example/analysis.ts:1:23: Type error TS2307 Cannot find module 'benchmark' or its corresponding type declarations. ✖ src/type-system.ts:1:23: Type error TS2724 '"@sinclair/typebox"' has no exported member named 'NumberOptions'. Did you mean 'NumericOptions'? ✖ build.ts:2:37: Type error TS2307 Cannot find module 'tsup' or its corresponding type declarations. ✖ example/video.ts:4:12: Type error TS2345 Argument of type 'BunFile' is not assignable to parameter of type 'Handler<MergeSchema<UnwrapRoute<InputSchema<never>, {}>, {}>, { request: {}; store: {}; }, "/">'. ✖ example/extension.ts:5:53: Type error TS2339 Property 'extends' does not exist on type 'Elysia<"", false, { decorator: {}; store: {}; derive: {}; resolve: {}; }, { type: {}; error: {}; }, { schema: {}; macro: {}; }, {}, { derive: {}; resolve: {}; schema: {}; }, { derive: {}; resolve: {}; schema: {}; }>'. ✖ example/extension.ts:6:5: Type error TS7031 Binding element 'onBeforeHandle' implicitly has an 'any' type. ✖ example/extension.ts:6:21: Type error TS7031 Binding element 'events' implicitly has an 'any' type. ✖ test/aot/response.test.ts:9:2: Type error TS2578 Unused '@ts-expect-error' directive. ✖ example/schema.ts:63:23: Type error TS2339 Property 'meta' does not exist on type 'Elysia<"", false, { decorator: {}; store: {}; derive: {}; resolve: {}; }, { type: { readonly name: { name: string; }; readonly b: { response: number; }; readonly authorization: { authorization: string; }; }; error: {}; }, { ...; }, { ...; }, { ...; }, { ...; }>'. ✖ example/schema.ts:63:38: Type error TS2304 Cannot find name 'SCHEMA'. ✖ example/schema.ts:64:23: Type error TS2339 Property 'meta' does not exist on type 'Elysia<"", false, { decorator: {}; store: {}; derive: {}; resolve: {}; }, { type: { readonly name: { name: string; }; readonly b: { response: number; }; readonly authorization: { authorization: string; }; }; error: {}; }, { ...; }, { ...; }, { ...; }, { ...; }>'. ✖ example/schema.ts:64:38: Type error TS2304 Cannot find name 'DEFS'. ✖ example/schema.ts:65:23: Type error TS2339 Property 'meta' does not exist on type 'Elysia<"", false, { decorator: {}; store: {}; derive: {}; resolve: {}; }, { type: { readonly name: { name: string; }; readonly b: { response: number; }; readonly authorization: { authorization: string; }; }; error: {}; }, { ...; }, { ...; }, { ...; }, { ...; }>'. ✖ example/schema.ts:65:38: Type error TS2304 Cannot find name 'SCHEMA'. ✖ src/ws/types.ts:68:9: Type error TS2503 Cannot find namespace 'Bun'. ✖ src/ws/types.ts:68:9: Type error TS4081 Exported type alias 'LocalHook' has or is using private name 'Bun'. ✖ src/ws/types.ts:69:32: Type error TS2503 Cannot find namespace 'Bun'. ✖ src/ws/types.ts:69:32: Type error TS4081 Exported type alias 'LocalHook' has or is using private name 'Bun'. ✖ test/lifecycle/transform.test.ts:70:24: Type error TS2554 Expected 1 arguments, but got 2. ✖ test/core/elysia.test.ts:124:4: Type error TS2578 Unused '@ts-expect-error' directive. ✖ test/types/scoped.ts:138:50: Type error TS2344 Type '{ derive: { readonly b: "b"; }; }' does not satisfy the constraint '"Expected: ..., Actual: boolean"'. ✖ test/core/modules.test.ts:141:49: Type error TS2339 Property 'derived' does not exist on type '{ body: unknown; query: Record<string, string | undefined>; params: never; headers: Record<string, string | undefined>; cookie: Record<string, Cookie<any>>; ... 4 more ...; error: <const Code extends number | ... 59 more ... | "Network Authentication Required", const T = Code extends 100 | ... 58 more ... | 511 ? { ...'. ✖ test/types/scoped.ts:144:51: Type error TS2344 Type '{ derive: { readonly b: "b"; }; }' does not satisfy the constraint '{ derive: "Expected: ..., Actual: never"; b: "Expected: never, Actual: literal string: b"; }'. ✖ test/types/scoped.ts:144:51: Type error TS2344 Type '{ derive: { readonly b: "b"; }; }' does not satisfy the constraint '{ derive: "Expected: ..., Actual: never"; b: "Expected: never, Actual: literal string: b"; }'. ✖ test/lifecycle/transform.test.ts:225:24: Type error TS2554 Expected 1 arguments, but got 2. ✖ src/compose.ts:821:12: Type error TS2339 Property 'Default' does not exist on type 'typeof Value'. ✖ src/compose.ts:849:12: Type error TS2339 Property 'Default' does not exist on type 'typeof Value'. ✖ src/compose.ts:877:12: Type error TS2339 Property 'Default' does not exist on type 'typeof Value'. ✖ src/compose.ts:906:13: Type error TS2339 Property 'Default' does not exist on type 'typeof Value'. ✖ src/compose.ts:936:12: Type error TS2339 Property 'Default' does not exist on type 'typeof Value'. ✖ src/index.ts:4266:30: Type error TS2503 Cannot find namespace 'Bun'. ✖ src/index.ts:5208:7: Type error TS2352 Conversion of type '{ websocket: { message(ws: ServerWebSocket<any>, message: string | Buffer): void | Promise<void>; open?(ws: ServerWebSocket<any>): void | Promise<...>; ... 10 more ...; perMessageDeflate?: boolean | ... 1 more ... | undefined; }; ... 8 more ...; reusePort: boolean; } | ... 62 more ... | { ...; }' to type 'Serve' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. ✖ src/index.ts:5220:7: Type error TS2352 Conversion of type '{ websocket: { message(ws: ServerWebSocket<any>, message: string | Buffer): void | Promise<void>; open?(ws: ServerWebSocket<any>): void | Promise<...>; ... 10 more ...; perMessageDeflate?: boolean | ... 1 more ... | undefined; }; ... 8 more ...; reusePort: boolean; } | ... 6 more ... | { ...; }' to type 'Serve' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Many of the errors that it shows do not exist...
Does this problem still persists in the latest version?
Does this problem still persists in the latest version?
Looks likes this library shows errors which did't exists in elysia source code Idk why
Create a package with
elysia
&check-dts
. Runbun -b check-dts
.tsconfig.json
There should be no errors. However, the following errors appear. The first 3 errors are related to elysia. The rest are reported with bun-types.