-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
TS2604 and TS2786 for "rc-field-form" under moduleResolution node16 and package.json#type = "module" #56935
Comments
https://arethetypeswrong.github.io/?p=rc-field-form%401.41.0 |
Given the package.json(irrelevant fields are edited) of {
"name": "rc-field-form",
"version": "1.32.0",
"description": "React Form Component",
"typings": "es/index.d.ts",
"engines": { "...":" ..." },
"keywords": ["..."],
"homepage": "https://github.com/react-component/field-form",
"author": "[email protected]",
"repository": { "...":" ..." },
"bugs": { "...":" ..." },
"files": [ "..." ],
"license": "MIT",
"main": "./lib/index",
"module": "./es/index",
"scripts": { "...":" ..." },
"peerDependencies": { "...":" ..." },
"dependencies": { "...":" ..." },
"devDependencies":{ "...":" ..." },
}
which did not contains the EDIT: Probably this is irrelevant, the contents of "/path/to/node_modules/rc-field-form/lib/index" and "/path/to/node_modules/rc-field-form/es/index" are actually the same. |
It doesn’t contain "typings": "es/index.d.ts", which would explain why TS is looking up the ESM types. I think the |
Both CommonJS and ESM entry point of rc-field-form are emit by tsc from the same source, and it looks innocent. It looks like |
You can tell from the output of
You can tell from
You can also tell that rc-field-form doesn't support ESM importing by just trying it!
This isn't supported and doesn't work; see #54593 |
🔎 Search Terms
moduleResolution node16, "rc-field-form"
🕗 Version & Regression Information
When trying to upgrading to latest typescript, due to #54567, the moduleResolution has to be changed to
"moduleResolution": "node16"
, but blocked by the bug that"rc-field-form"
does not work under"moduleResolution": "node16"
and package.json#type = "module", while it's accepted under"moduleResolution": "node"
prior to Typescript 5.1⏯ Playground Link
No response
💻 Code
The following code compiles under
"moduleResolution": "node"
but rejected under"moduleResolution": "node16"
.with tsconfig:
and package.json:
🙁 Actual behavior
🙂 Expected behavior
It's expected to be accepted by tsc.
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: