Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add types at package.json exports #1881

Merged
merged 1 commit into from
Nov 21, 2022
Merged

Conversation

mshima
Copy link
Contributor

@mshima mshima commented Nov 10, 2022

ESM only packages fails to find the types.

A copy of type file is required to make tsc succeed:
https://github.com/jhipster/generator-jhipster/blob/main/jdl/chevrotain.d.ts

Reference for package.json exports field:
https://www.typescriptlang.org/docs/handbook/esm-node.html#packagejson-exports-imports-and-self-referencing

    "exports": {
        ".": {
            // Entry-point for TypeScript resolution - must occur first!
            "types": "./types/index.d.ts",
            // Entry-point for `import "my-package"` in ESM
            "import": "./esm/index.js",
            // Entry-point for `require("my-package") in CJS
            "require": "./commonjs/index.cjs",
        },
    },

@bd82 bd82 changed the title add types at package.json exports chore: add types at package.json exports Nov 21, 2022
@bd82 bd82 merged commit b448a19 into Chevrotain:master Nov 21, 2022
@bd82
Copy link
Member

bd82 commented Nov 21, 2022

Thanks @mshima 👍

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.

2 participants