Skip to content

Comments

Add "types" to package.json exports to fix module type resolution#264

Open
trevorsmith wants to merge 1 commit intobalazsbotond:masterfrom
trevorsmith:master
Open

Add "types" to package.json exports to fix module type resolution#264
trevorsmith wants to merge 1 commit intobalazsbotond:masterfrom
trevorsmith:master

Conversation

@trevorsmith
Copy link

This commit fixes the following Typescript error:

Could not find a declaration file for module 'urlcat'. 'foo/node_modules/urlcat/dist/index.mjs' implicitly has an 'any' type.
There are types at 'foo/urlcat/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'urlcat' library may need to update its package.json or typings.

Copy link

@Jack-Works Jack-Works left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change is wrong.

    ".": {
      "import": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" },
      "require": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
    }

this is correct (not strictly, but reasonably correct). you may want to know more about how the ordering is important, and how "types" in "exports" actually work.

@PranayPant
Copy link

any plans to merge?

@masajid390
Copy link

Are there any plans to merge that?

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.

4 participants