-
Notifications
You must be signed in to change notification settings - Fork 80
feat: export types from main entry point #520
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
Conversation
fasttime
left a comment
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.
LGTM, thanks. Leaving open for a second review.
JoshuaKGoldberg
left a comment
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.
Great! IMO a single almost-blank file is not a very high price to pay for easier type imports.
Thanks for pushing on this @lumirlumir!
|
@JoshuaKGoldberg Thanks for understanding that I took on the issue you originally suggested. |
nzakas
left a comment
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.
LGTM. Thanks.
Prerequisites checklist
What is the purpose of this pull request?
In this PR, I've exported all types from
src/types.tsthrough the main entry point.Previously, to access the global types defined in
src/types.ts, they had to be imported from@eslint/markdown/types. After this change, they can be imported directly from@eslint/markdown.What changes did you make? (Give an overview)
To enable importing types from the main entry point, I used a small trick.
The
types.tsfile is built intotypes.jsandtypes.d.ts.In the built
types.js, it's possible to re-export the type declarations from the main entry point usingexport * from "types.js".However, that wasn't possible in the source. To bridge the gap, I added a dummy
src/types.jsfile so types can be imported fromsrc/types.ts.Related Issues
Ref: eslint/json#130, eslint/json#130 (comment), #453, #367 (comment)
Is there anything you'd like reviewers to focus on?
N/A