-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat: Add types
to exports
#84
base: main
Are you sure you want to change the base?
Conversation
Hi @mrmckeb!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.
To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page. Read more about contributing to ESLint here |
The committers listed above are authorized under a signed CLA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Can you also add some tests to verify that this works as expected? (tests/types/types.test.ts
)
@eslint/eslint-tsc Wanted to verify with everyone that we're okay with exporting types this way? Or should we aim to export types from .
(which would require a bit of scripting).
Thanks for the prompt review and feedback @nzakas. I'll wait for the response around exporting types this way, and then either rework this PR or update the tests. |
I'm fine with this approach. @fasttime what do you think? |
I'm also fine with this approach. Note though that we need a separate export for CommonJS types, along the lines of: "./types": {
"require": {
"types": "./dist/cjs/types.cts"
},
"import": {
"types": "./dist/esm/types.d.ts"
}
} This is to avoid the TypeScript error Type-only import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute. |
Prerequisites checklist
What is the purpose of this pull request?
Enables users to import additional types.
What changes did you make? (Give an overview)
This PR adds the
types
file topackage.json#exports
, allowing users to import types not exposed via the index files from the/types
export.Related Issues
Closes #82
Is there anything you'd like reviewers to focus on?
N/A