Chevrotain / chevrotain

Parser Building Toolkit for JavaScript
https://chevrotain.io
Apache License 2.0
2.44k stars 200 forks source link

chore: add types at package.json exports #1881

Closed mshima closed 1 year ago

mshima commented 1 year ago

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 commented 1 year ago

Thanks @mshima 👍