-
Notifications
You must be signed in to change notification settings - Fork 90
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
docs: add types
to default exports
#226
Conversation
Hm, are you sure about this change? @andrewbranch mentioned in this comment that this is only possible if the
Eg. see this similar change from Or this solution that I came up with for
And Maybe @andrewbranch can weigh in here on what the best approach is? Hopefully I'm not the one who's wrong here! If I am, sorry for the noise! |
I was wrong when I said this. Wishful thinking—a single |
/cc @danielroe |
types
exports field for TypeScript ESMtypes
to default exports
types
to default exports
types
to default exports
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.
We are doing this by default for new UNJS packages and in template, considering types are targeting esm first. (any ideas more than welcome to not advice using
types field)
@pi0 from my understanding of the conversation above, a single Using a single
|
Right, that's what Andrew's comment above is saying, if I'm understanding correctly - *do not* use the
What I understand from this comment is that |
Okay, reverted the suggestion for now until can do more research on this. Just saying rest of unjs packages (like h3) already adopted this kind of |
Sorry, missed the discussion here. Very informative and helpful. Should have done more research before making this change 😅 Now I need to make up for some of my previous similar PRs to other projects... but I do think if tools are currently lacking, "masquerading" is better than no types at all. (Not saying it's better than correct types.) |
"Masquerading" is probably too soft of a word. If it is marked as "Masquerading ..." it is broken. Not any better than missing types. |
This is required for TypeScript to work under
"module": "node16"
, see https://github.com//microsoft/TypeScript/issues/47792.