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
Could not find a declaration file for module 'teaful'. '/tmp/t/node_modules/teaful/dist/index.modern.js' implicitly has an 'any' type.
There are types at '/tmp/t/node_modules/teaful/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'teaful' library may need to update its package.json or typings.ts(7016)
when trying to import package with moduleResolution set to bundler/node16/nodenext.
Import will work correctly with moduleResolution:node (or alias node10), but it should be used with node.js versions before v10 (according to TypeScript doc).
There will be no error without strict:true, but createStore will has no types as well.
What did you expect to happen?
According to TS doc, moduleResolution specifies the module resolution strategy:
'node16' or 'nodenext' for modern versions of Node.js.
'bundler' for use with bundlers.
So teaful should be importable that way.
Looks like each export should have it's own declaration file with matching name, i.e. index.d.ts for index.js, index.modern.d.ts for index.modern.js, etc. I have checked, import will work correctly if node_modules/teaful/dist/index.d.ts is copied to node_modules/teaful/dist/index.modern.d.ts.
OR "exports" entries in package.json should have their own "type" field with path to declaration file. I have checked, package.json with this exports works too:
What version of this package are you using?
[email protected]
[email protected]
What operating system, Node.js, and npm version?
OS: Arch Linux
Node.js: v23.1.0
npm: 10.9.0
What happened?
when trying to import package with
moduleResolution
set tobundler
/node16
/nodenext
.index.ts:
tsconfig.json:
Import will work correctly with
moduleResolution:node
(or aliasnode10
), but it should be used with node.js versions before v10 (according to TypeScript doc).There will be no error without
strict:true
, butcreateStore
will has no types as well.What did you expect to happen?
According to TS doc,
moduleResolution
specifies the module resolution strategy:So
teaful
should be importable that way.Looks like each export should have it's own declaration file with matching name, i.e.
index.d.ts
forindex.js
,index.modern.d.ts
forindex.modern.js
, etc. I have checked, import will work correctly ifnode_modules/teaful/dist/index.d.ts
is copied tonode_modules/teaful/dist/index.modern.d.ts
.OR
"exports"
entries inpackage.json
should have their own"type"
field with path to declaration file. I have checked,package.json
with thisexports
works too:The text was updated successfully, but these errors were encountered: