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 |
nzakas
left a comment
There was a problem hiding this comment.
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. |
|
Thanks @mdjermanovic and @fasttime. I've made those changes. I'd been working/testing in an ESM-only environment, so that was a good catch. |
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
typesfile topackage.json#exports, allowing users to import types not exposed via the index files from the/typesexport.Related Issues
Closes #82
Is there anything you'd like reviewers to focus on?
N/A