You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using typescript with {"module": "NodeNext","moduleResolution": "nodenext",}, the module @types/loadable__component exports {default:loadableFunc} when it should export loadableFunc.
import loadable from "@loadable/component";
loadable(() => import("./component.ts"));
Typescript will print this error:
test.ts:4:1 - error TS2349: This expression is not callable.
Type 'typeof import("/Users/simonparis/temp/node_modules/@types/loadable__component/index")' has no call signatures.
4 loadable(() => import("./component.ts"));
~~~~~~~~
I don't fully understand this behavior, but setting type:module in the package.json file of the types package seems to fix it. Unsure if that would break anything. The types package may need both a CJS and ESM copy.
🐛 Bug Report
When using typescript with
{"module": "NodeNext","moduleResolution": "nodenext",}
, the module@types/loadable__component
exports{default:loadableFunc}
when it should exportloadableFunc
.To Reproduce
With this typescript config:
And this code:
Typescript will print this error:
I don't fully understand this behavior, but setting
type:module
in the package.json file of the types package seems to fix it. Unsure if that would break anything. The types package may need both a CJS and ESM copy.Expected behavior
This should not be an error.
Link to repl or repo (highly encouraged)
https://github.com/simon-paris/loadable-types-bug-repro
Issues without a reproduction link are likely to stall.
Run
npx envinfo --system --binaries --npmPackages @loadable/component,@loadable/server,@loadable/webpack-plugin,@loadable/babel-plugin --markdown --clipboard
Paste the results here:
The text was updated successfully, but these errors were encountered: