-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
Bug Report
π Search Terms
nodenext, node16, ESM, exports, package.json, dependency, postcss
π Version & Regression Information
β― 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
import postcss from "postcss";
console.log(postcss());tsconfig.json
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node16",
"lib": ["esnext", "dom"],
"strict": true
}
}package.json
{
"name": "typescript-error-example",
"private": true,
"type": "module",
"license": "UNLICENSED",
"dependencies": {
"postcss": "^8.4.14",
"typescript": "^4.8.0-beta"
}
}π Actual behavior
Running npm i && tsc --noEmit on a directory configured like above produces the following error.
index.ts(3,13): error TS2349: This expression is not callable.
Type 'typeof import("/Users/briankim/typescript-example/node_modules/postcss/lib/postcss")' has no call signatures.
π Expected behavior
Running npm i && tsc --noEmit should produce no errors
Deleting "type": "module" from package.json or changing the moduleResolution to node in tsconfig.json makes the error go away. π
chentsulin, wessberg, der-daniel, JoshuaKGoldberg, juandavidkincaid and 1 more
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
