Add TypeScript types entry to package.json #18

Closed
ioder wants to merge 1 commit from ioder/patch-1 into master
ioder commented 2025-11-26 09:22:29 +01:00 (Migrated from github.com)

Exports field needs types definition for each entry in order to work correctly with bundler mode for typescript (tsconfig).

error TS7016: Could not find a declaration file for module 'w3c-keyname'. '/app/build/node_modules/w3c-keyname/index.es.js' implicitly has an 'any' type.
  There are types at '/app/node_modules/w3c-keyname/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'w3c-keyname' library may need to update its package.json or typings.

2 import { base } from 'w3c-keyname'
Exports field needs types definition for each entry in order to work correctly with bundler mode for typescript (tsconfig). ``` error TS7016: Could not find a declaration file for module 'w3c-keyname'. '/app/build/node_modules/w3c-keyname/index.es.js' implicitly has an 'any' type. There are types at '/app/node_modules/w3c-keyname/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'w3c-keyname' library may need to update its package.json or typings. 2 import { base } from 'w3c-keyname' ```
ioder commented 2025-11-26 09:22:53 +01:00 (Migrated from github.com)

@marijnh I have issues switching my project to bundler mode (typescript). I proposed a fix here.

@marijnh I have issues switching my project to bundler mode (typescript). I proposed a fix here.
marijnh commented 2025-11-26 09:25:27 +01:00 (Migrated from github.com)

What kind of TypeScript configuration produces this error? And are you using version 2.2.6 or higher of w3c-keyname?

What kind of TypeScript configuration produces this error? And are you using version 2.2.6 or higher of w3c-keyname?
marijn closed this pull request 2026-03-18 10:59:27 +01:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
marijn/w3c-keyname!18
No description provided.