Elysia type inference breaks on monorepos
Closed this issue · 1 comments
Pedromigacz commented
What version of Elysia is running?
1.1.22
What platform is your computer?
WSL2 on Windows (Microsoft Windows NT 10.0.19045.0 x64)
What steps can reproduce the bug?
I think the easiest way is to clone the example monore:
https://github.com/SaltyAom/elysia-monorepo-example
- Create a bun monorepo
- Do any type of validation using elysia
- If it's on elysia 1.0.*
You get unknown as the type inference for body, params, query, etc...
If it's on elysia 1.1.*
You get any as the type inference for body, params, query, etc...
What is the expected behavior?
Elysia should infer the types correctly after the validation
What do you see instead?
Everything is typed as any
or unknown
depending on which version of elysia you are running.
Additional information
Things tried to debug it:
- rm -rf node_modules && bun.lockb
- downgrading elysia until
- Adding bun types globally using tsconfig.json and installing it to the package.json.
- Installing
@sinclair/typebox
directly and trying to use it for validation. The result is the same behavior as when using elysia version 1.0.27 and under. (unknown infered for body, params, etc)
Have you try removing the node_modules
and bun.lockb
and try again yet?
Yes
Pedromigacz commented
Sorry, this is not a real bug, I messed up my tsconfig.json.
// Changing
"strictNullChecks": false to true
// solved the issue for me.