Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node16 or bundler module resolution causes TS2742 error #1195

Closed
david10sing opened this issue Feb 1, 2024 · 1 comment · Fixed by #1215
Closed

Node16 or bundler module resolution causes TS2742 error #1195

david10sing opened this issue Feb 1, 2024 · 1 comment · Fixed by #1215
Assignees
Labels
bug Something isn't working mock Related to mock generation
Milestone

Comments

@david10sing
Copy link
Contributor

david10sing commented Feb 1, 2024

What are the steps to reproduce this issue?

  1. Use orval in a repo where the tsconfig moduleResolution is set to node16 or bundler
  2. 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 were you expecting to happen?

TS2742 should not happen.

Any logs, error output, etc?

Please see above

Any other comments?

Possibly linked to:

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.

@melloware
Copy link
Collaborator

Yes please submit a PR for review!

@melloware melloware added the bug Something isn't working label Feb 1, 2024
@melloware melloware added this to the 6.25.0 milestone Feb 1, 2024
@melloware melloware added the mock Related to mock generation label Feb 5, 2024
@melloware melloware modified the milestones: 6.25.0, 6.26.0 Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mock Related to mock generation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants