Skip to content

Add TypeScript types entry to package.json#3

Open
ktarmyshov wants to merge 1 commit intoechecsjs:mainfrom
ktarmyshov:main
Open

Add TypeScript types entry to package.json#3
ktarmyshov wants to merge 1 commit intoechecsjs:mainfrom
ktarmyshov:main

Conversation

@ktarmyshov
Copy link
Copy Markdown

@ktarmyshov ktarmyshov commented Apr 15, 2026

Hi, Adrian!

I found your library and wanted to use it in my project, but ran into a TypeScript resolution issue because I am using "moduleResolution": "node".

The package already exposes declarations via exports.types, but adding a top-level "types" field would improve compatibility for TypeScript consumers using older resolver settings. Switching to nodenext is not always a small change, because it also requires updating internal relative imports to include .js.

I tested this by adding the following line locally in node_modules, and it resolved the issue in my project:

"types": "./dist/index.d.ts"

This seems like a small, non-breaking compatibility improvement that could reduce adoption friction.

Thank you!

Konstantin

Description

Resolve import issue in projects with older "moduleResolution": "node" setting in tsconfig.json.

Type of change

  • Bug fix
  • New feature
  • Refactor / internal improvement
  • Documentation update
  • Dependency update

Checklist

  • Tests added or updated for all changed behaviour
  • All checks pass (pnpm lint && pnpm test && pnpm build)
  • CHANGELOG.md updated (for bug fixes and new features)

Better compatibility for "moduleResolution": "node" tsconfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant