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
> tsc; node main
main.ts:3:43 - error TS2339: Property 'default' does not exist on type '{ a: number; }'.
3 console.log('this works at runtime:', foo.default.a)
~~~~~~~
Found 1 error in main.ts:3
this works at runtime: 1
π Expected behavior
no compile error, because at runtime it's not a real default export, but rather an object with a property called default on it
Additional information about the issue
changing moduleResolution to nodenext fixes the issue, but i don't think this is intended behavior because according to the docs the only thing that should be different to node16/nodenext is that it doesn't enforce the file extensions:
'bundler' for use with bundlers. Like node16 and nodenext, this mode supports package.json "imports" and "exports", but unlike the Node.js resolution modes, bundler never requires file extensions on relative paths in imports.
The text was updated successfully, but these errors were encountered:
π Search Terms
moduleresolution bundler default import commonjs
π Version & Regression Information
5.3.0-dev.20230908
β― Playground Link
No response
π» Code
my code
tsconfig.json
main.ts
third party commonjs package
foo.cjs
foo.d.cts
π Actual behavior
π Expected behavior
no compile error, because at runtime it's not a real default export, but rather an object with a property called
default
on itAdditional information about the issue
changing
moduleResolution
tonodenext
fixes the issue, but i don't think this is intended behavior because according to the docs the only thing that should be different tonode16
/nodenext
is that it doesn't enforce the file extensions:The text was updated successfully, but these errors were encountered: