Type Errors
See original GitHub issueHi there,
first of all: Thanks a lot for creating trpc 😃 I just recently stumpled upon it and I’m quite enthusiastic about it’s design.
Now to the problem:
I’m trying to use trpc in a pnpm-driven monorepo. When I try to compile the package that’s using trpc (both @trpc/server
and @trpc/client
), tsc
fails with:
../../../../node_modules/.pnpm/@trpc+server@9.23.4/node_modules/@trpc/server/dist/declarations/src/adapters/node-http/types.d.ts:3:16 - error TS2307: Cannot find module 'qs' or its corresponding type declarations.
3 import qs from 'qs';
[...]
../../../../node_modules/.pnpm/@trpc+server@9.23.4/node_modules/@trpc/server/dist/declarations/src/adapters/standalone.d.ts:5:107 - error TS2344: Type 'IncomingMessage' does not satisfy the constraint 'NodeHTTPRequest'.
Type 'IncomingMessage' is not assignable to type '{ method?: string; query?: any; body?: unknown; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Types of property 'method' are incompatible.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
5 export declare type CreateHTTPHandlerOptions<TRouter extends AnyRouter> = NodeHTTPHandlerOptions<TRouter, http.IncomingMessage, http.ServerResponse>;
The first one
TS2307: Cannot find module 'qs' or its corresponding type declarations.
can be fixed by installing @types/qs
. However, I don’t think that should be necessary.
The second one
TS2344: Type 'IncomingMessage' does not satisfy the constraint 'NodeHTTPRequest'.
isn’t explicable to me but at least resembles one of the errors documented in #1022.
This issue was closed by #1151, which should be included with the trpc version I’m using (9.23.4).
It’s possible that this is related to my use of pnpm.
Any hint would be appreciated 😃 I’ll keep you posted, if I find anything myself.
Issue Analytics
- State:
- Created a year ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Type I & Type II Errors | Differences, Examples, Visualizations
In statistics, a Type I error is a false positive conclusion, while a Type II error is a false negative conclusion.
Read more >Type I and type II errors - Wikipedia
In statistical hypothesis testing, a type I error is the mistaken rejection of an actually true null hypothesis (also known as a "false...
Read more >What are Type I and Type II Errors? - Simply Psychology
A type 1 error is also known as a false positive and occurs when a researcher incorrectly rejects a true null hypothesis. This...
Read more >Statistics: What are Type 1 and Type 2 Errors? - AB Tasty
Type 1 errors – often assimilated with false positives – happen in hypothesis testing when the null hypothesis is true but rejected.
Read more >Type II Error Explained, Plus Example & vs. Type I Error
A Type II error can be contrasted with a type I error is the rejection of a true null hypothesis, whereas a type...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks a lot, @sachinraja & @KATT - fix works like a charm.
You guys are great! 👍
@sachinraja
Then it’s plausible I’m getting the error, because I’m using
fastify
😃@KATT
Here’s a minimal reproduction: https://github.com/grebaldi/trpc-1904-repro