-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[v7] TS automatic imports in VSCode default to wrong path #6067
Comments
This issue in TypeScript seems related: microsoft/TypeScript#30472 I'm not really sure what the resolution to this is. If it's on our end, or if it's in your tsconfig. @cartant @RyanCavanaugh any ideas? |
@voliva do you have to same issues with RxJS 6.x? |
One primary difference I see between 6.x and 7.x is in 6.x we have the CJS root and typings root right next to each other. Where they are not next to each other in 7.x: 6.x package.json: {
"main": "./index.js",
"typings": "./index.d.ts",
"module": "./_esm5/index.js",
"es2015": "./_esm2015/index.js"
} 7.x package.json: {
"main": "./dist/cjs/index.js",
"types": "./dist/types/index.d.ts",
"module": "./dist/esm5/index.js",
"es2015": "./dist/esm/index.js",
} |
No, with RxJS 6.x it seems to be working fine - It happened on both projects of mine that I upgraded to try 7.x, both of them on two different computers, one running MacOS Catalina, the other Windows 10. And the minimal example I posted in the issue description also causes that. I'm sorry I can't help much - I've tried some combinations that would make sense with the new dist structure, but it seems I can't get it to work. My colleague uses neovim and it seems that he doesn't have this issue on his editor. Maybe I should take this opportunity to give vim another try 😅. Is it reproducible by other VSCode users though? |
TBH, I don't think there's a great deal that can be done until the Long-term, I think the deprecated names that conflict should be removed and everything should be imported from |
I suppose we could also try renaming |
Haha... |
FWIW: We do now have the exports set in our package.json. |
This is an attempt to fix issues with VS Code auto-import, as described here in this issue: https://github.com/microsoft/TypeScript/issues/43034\#issuecomment-820621280 Related ReactiveX#6067
This is an attempt to fix issues with VS Code auto-import, as described here in this issue: https://github.com/microsoft/TypeScript/issues/43034\#issuecomment-820621280 Related #6067
This is now resolved in the latest 7.0.0-rc.1. From #6229 |
In the rc.1 version, I get "error TS2307: Cannot find module 'rxjs' or its corresponding type declarations.", is this a breaking change? |
While the applied fix did fix the issue in VS Code, it also broke |
- Adds typesVersions, enforcing TypeScript >= 4.2. - Adds some superfluous imports required for TS and VS Code to find proper import locations for our strange deep import sites. - Independantly tested by building the package and installing it locally in another project, then testing in VS code. Fixes ReactiveX#6067 Related microsoft/TypeScript#43034
- Adds typesVersions, enforcing TypeScript >= 4.2. - Adds some superfluous references required for TS and VS Code to find proper import locations for our strange deep import sites. - Independantly tested by building the package and installing it locally in another project, then testing in VS code. Fixes ReactiveX#6067 Related microsoft/TypeScript#43034
- Adds typesVersions, enforcing TypeScript >= 4.2. - Adds some superfluous references required for TS and VS Code to find proper import locations for our strange deep import sites. - Independantly tested by building the package and installing it locally in another project, then testing in VS code. Fixes #6067 Related microsoft/TypeScript#43034
Hi I have the same issue when importing Subjects with rxjs@7.0.1. The wrong import results in a runtime error. This works fine with rxjs 6. Do you have any idea about this ? |
Bug Report
Current Behavior
When using operators in VSCode, the suggested import defaults to
rxjs/dist/types/operators
, failing in runtime.This wasn't happening in v6, starts happening after upgrading to v7.
Expected behavior
VSCode imports from the correct
rxjs/operators
pathReproduction
mkdir rxjs-playground cd rxjs-playground npm init -y npm i rxjs@next
Environment
Additional context/Screenshots
Note that after correcting it to
rxjs/operators
it correctly suggests adding the import from the right placeThe text was updated successfully, but these errors were encountered: