Add type exports support in package #10

Closed
aminpaks wants to merge 2 commits from amin/add-type-exports into main
aminpaks commented 2023-10-26 15:56:24 +02:00 (Migrated from github.com)

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

Adds the proper value in `package.exports` for TypeScript to pick the type declarations.
marijnh commented 2023-10-26 16:25:50 +02:00 (Migrated from github.com)

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

What concrete problem does this solve? As far as I know, TS will already pick up the current declaration files.
aminpaks commented 2023-10-26 19:18:14 +02:00 (Migrated from github.com)

@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 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](https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution).
marijnh commented 2023-10-26 20:13:08 +02:00 (Migrated from github.com)

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.

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 2023-10-26 20:37:27 +02:00 (Migrated from github.com)

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. 🙏

> 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 2023-10-26 21:48:01 +02:00 (Migrated from github.com)

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

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

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lezer/highlight!10
No description provided.