Skip to content

exports declaration not compatible with typescript nodenext #84

@marcoreni

Description

@marcoreni

When using nodenext, importing the library with Typescript causes an error:

Could not find a declaration file for module 'tiny-lru'. '{omit}/node_modules/.pnpm/[email protected]/node_modules/tiny-lru/dist/tiny-lru.js' implicitly has an 'any' type.
  There are types at '{omit}/node_modules/tiny-lru/lru.d.ts', but this result could not be resolved when respecting package.json "exports". The 'tiny-lru' library may need to update its package.json or typings. ts(7016)

Types should be included in the exports object:

"exports": {
    "types": "./lru.d.ts",
    "import": "./dist/tiny-lru.js",
    "require": "./dist/tiny-lru.cjs"
  },

Ref: https://www.typescriptlang.org/docs/handbook/esm-node.html#packagejson-exports-imports-and-self-referencing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions