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
moduleResolution
nodenext
or node16
causes type errors with a default callable export (PostCSS)
#50175
Comments
The error is working as expected. declare const postcss: Postcss
export default postcss If they are honest, then the corresponding JS file should be module.exports = postcss
postcss.default = postcss The information that |
Iβm not sure about the distinction between setting the Before yβall mark this as an upstream issue, I would like to say that PostCSS is not the only library with this problem. Iβve also seen it with |
In |
This is a bug (to confirm, change the test to |
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
@RyanCavanaugh - to be clear, you mean it's a bug that calling the default worked, and that the definitions should be updated? Assuming that's true, what is the suggested approach? |
Bug Report
π Search Terms
nodenext, node16, ESM, exports, package.json, dependency, postcss
π Version & Regression Information
typescript@4.7.4
β― Playground Link
Playground link with relevant code
Hilariously, the playground only seems to show this bug intermittently or doesnβt save the config. I can usually force the error to appear by setting the
module
configuration in the settings.π» Code
index.ts
tsconfig.json
package.json
typescript-example.zip
π Actual behavior
Running
npm i && tsc --noEmit
on a directory configured like above produces the following error.π Expected behavior
Running
npm i && tsc --noEmit
should produce no errorsDeleting
"type": "module"
frompackage.json
or changing themoduleResolution
tonode
intsconfig.json
makes the error go away. πThe text was updated successfully, but these errors were encountered: