-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
"export type * as namespace" also exports value #36966
Comments
As per thi-ng/umbrella#209 it seems |
They were (accidentally) allowed, but they didn’t work fine—they were interpreted as a normal, non-type-only export, as the OP’s example shows. The 3.8 blog post covers the feature in detail, but the TL;DR is: Allowed imports:
Not allowed imports:
Allowed exports:
Not allowed exports:
I will further say that I don’t personally have strong feelings against enabling |
Thanks for the update @andrewbranch - I actually did read that blog post a while ago and could have sworn there was a mention of |
@andrewbranch I'm sorry, but I will have to ask for some more guidance from you about this export type behavior, especially with As an example, let's take this project in question: @thi.ng/api. This linked
The build issue mentioned above has to with that current form (1), my published project actually contains invalid (empty) ES modules (i.e. those which only contained type decls and IMHO should have been elided as with options 2 & 3) and building a userland project with From that all, it seems my only viable option is to disable |
Addendum to the above comment: After some deeper enquiry, that build issue I've been encountering might actually have to do with snowpack (which uses Still, I'd highly appreciate to get some more clarity on the correctness/expected behavior of using the different export types WRT |
When you use Admittedly, I didn’t know setting |
Thank you for the detailed explanation @andrewbranch and am sorry for the slight confusion. I was aware of most of this, but this weird build issue somewhat threw me / made me doubt... meanwhile we fixed the snowpack issue already and I will employ the |
Upon recommendation by @andrewbranch: microsoft/TypeScript#36966 (comment)
TypeScript Version: 3.9.0-dev.20200222
Search Terms: export type * as namespace
Code
Expected behavior:
index1.ts
andindex2.ts
should have the same behaviour: export a namespace which only contain types, and the assignment tofoo
should result in an error.Actual behavior:
In
index2.ts
the assignment succeed.Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: