-
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
Incompatible with node12
TypesScript module resolution
#6641
Comments
This commit adds `types` mapping for the package `exports`. It makes the package compatible with the upcoming `node12` module resolution in TypeScript 4.5.0. Closes ReactiveX#6641
Same problem when "module": "esnext" is used. |
I think we may need few internal try to understand some of behaviors. One of notable thing is rxjs does not support native esm yet. I'm not sure what's implication if we add this property for both of cases, if tsc try to import as native esm vs. other tooling's esm handling behavior such as tree shaking. |
Peeking this bit more, there is specific concern from TSC's core team iteslf microsoft/TypeScript#46452. We will observe official release & discussion thread itself, along with some internal understandings how this'll affect across users of rxjs. Which means, we'll not try to make any immediate changes for now unfortunately. |
See ref: #6642 (comment) In short, tsc will not enable this for the release (https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-rc/#beta-delta)
Given we do not support our official release for non-release version of typescript, I do not think we'll going to have this until tsc gets finalized support for this feature. We'll keep follow latest upstream and will try to align with ecosystem but at this moment this issue better to be closed as no one knows later upstream tsc will have exact same way to support this or will there be breaking features. Please feel free to create new suggestions via discussions (https://github.com/ReactiveX/rxjs/discussions) for the feature request when tsc supports similar officially if needed. |
The types need to be mentioned in tsconfig.json I guess. |
I'm also facing the same issue (with My project {
"compilerOptions": {
"module": "commonjs",
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"lib": ["ES2019"],
"target": "es2019",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"strict": true,
"allowJs": true,
"skipLibCheck": true,
"jsx": "preserve"
},
"exclude": [
"dist/**"
]
} and $ node --version
v14.19.1
$ tsc --version
Version 4.1.3 How do I fix this issue? |
Bug Report
Current Behavior
I am trying out the upcoming TypeScript 4.5.0 version (currently in beta), and its new
"moduleResolution": "node12"
.With the following
tsconfig.json
:I get the following error when trying to import from
"rxjs"
:Expected behavior
The type declaration for
rxjs
should be resolved.Reproduction
The
tsconfig.json
should be enough to reproduce the issue. Here is a repo set-up to reproduce the issue: https://github.com/demurgos/rxjs-ts-node12.Environment
Possible Solution
Add a
types
field abovenode
to theexports
config in thepackage.json
.Additional context/Screenshots
node12
The text was updated successfully, but these errors were encountered: