You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use orval in a repo where the tsconfig moduleResolution is set to node16 or bundler
Generate react-query client where there are mutation queries
What happens?
The following gets reported in IDE and also when running npx tsc.
The inferred type of 'X' cannot be named without a reference to '../../node_modules/msw/lib/core/handlers/HttpHandler'. This is likely not portable. A type annotation is necessary.
The inferred type of 'X' cannot be named without a reference to '../../node_modules/@tanstack/react-query/build/modern/types'. This is likely not portable. A type annotation is necessary.
Declaration files where these errors happen do not get generated.
What are the steps to reproduce this issue?
moduleResolution
is set tonode16
orbundler
What happens?
The following gets reported in IDE and also when running
npx tsc
.Declaration files where these errors happen do not get generated.
What were you expecting to happen?
TS2742 should not happen.
Any logs, error output, etc?
Please see above
Any other comments?
Possibly linked to:
The inferred type of "X" cannot be named without a reference to "Y". This is likely not portable. A type annotation is necessary. microsoft/TypeScript#42873
Typescript error after updating to React Query v5 : "The inferred type of [...]" TanStack/query#6670
I think if we strictly type the return of the
useMutation
on the following line, it fixes this error. https://github.com/anymaniax/orval/blob/9b28acd87b88dee1b5556c9af7b446b429c92e79/packages/query/src/index.ts#L1451Same thing should be done for the mock files.
Strictly typing the returns would be a workaround until this is actually fixed upstream in TypeScript.
I can look into creating a PR for this. Please advise if you would like me to address this.
The text was updated successfully, but these errors were encountered: