lezer-parser / highlight

Syntax highlighting from Lezer trees
MIT License
30 stars 9 forks source link

Add type exports support in package #10

Closed aminpaks closed 11 months ago

aminpaks commented 11 months ago

Adds the proper value in package.exports for TypeScript to pick the type declarations.

marijnh commented 11 months ago

What concrete problem does this solve? As far as I know, TS will already pick up the current declaration files.

aminpaks commented 11 months ago

@marijnh if you set bundler or nodenext as your module resolution in TS config, it won't pick up the types property of the package.json, it will look for counterpart of exports. Read more here.

marijnh commented 11 months ago

Are you entirely sure that the current setup doesn't work? Because I'm using this system (make sure the declaration's filename matches the exported dist file) across all my packages, and it actually solves this problem, as far as I'm aware.

aminpaks commented 11 months ago

Are you entirely sure that the current setup doesn't work? Because I'm using this system (make sure the declaration's filename matches the exported dist file) across all my packages, and it actually solves this problem, as far as I'm aware.

I'm testing, and it seems it's working now. I'm not entire sure how it was failing but it was initially failing for me.

Thans for looking into it. 🙏

aminpaks commented 11 months ago

Apologies, I double checked, and it seems the issue was on v1.0.0. The latest has the correct path to types.