-
Notifications
You must be signed in to change notification settings - Fork 71
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: support emitDeclarationOnly
#366
feat: support emitDeclarationOnly
#366
Conversation
- when `emitDeclarationOnly` is set, only perform type-checking and emit declarations, don't transform TS - `result.code` actually doesn't exist when `emitDeclarationOnly` is set anyway - this caused a confusing situation for users who were trying to use Babel (with Babel plugins) on TS and only use rpt2 for declarations - instead of getting any JS code, they would just get empty chunks, bc `result.code` is `undefined` - that's kind of buggy, it should probably either be forced to `false` or do what we're doing now, which is likely more intuitive / intended - so now, instead of getting an empty chunk, rpt2 will just pass to the next plugin, allowing for other plugins on the chain to process TS - this opens up some new use cases, like using in tandem with Babel plugins (as the issue illustrates) or using for type-checking and declaration generation while using Vite / ESBuild for compilation - add a new paragraph to "Declarations" docs about this new feature and what it does and some examples of how it could be used - note that these are unexplored / untested integrations, so point that out in the docs too - also modify a self-reference further up in the docs to use code backticks for `rollup-plugin-typescript2` - while at it, also add a line about declaration maps - and reformat the existing paragraph a bit to match the style and improve readability - one sentence per line, which is all on the same paragraph in Markdown anyway - add a `<br />` element to add a new-line _within_ the paragraph for better readability / spacing - Markdown supports this only with two trailing spaces, which is difficult to see and the trailing whitespace can be trimmed by editors, so prefer `<br />`
Hi, when will the 0.32.2 version be released? |
I don't see version 0.32.2 on npm |
It hasn't been released yet. Could be good for a release after my current batch of PRs, but ezolenko handles releases currently. If you're wondering why the P.S. Didn't know Paimon was interested in my work 😝 |
OK, thx. P.S. Paimon is not only a tour guide, but also a programmer |
I found that dist is still 0.32.1, please help me to build 0.32.2 dist :( |
Yea I typically only build during a release. Makes for much cleaner diffs (and smaller diffs means smaller
You're welcome to fork and build it yourself and use that until a release is cut if you need this more urgently. |
@godPaimon thought I'd update you that this PR was released in |
Summary
Support
emitDeclarationOnly
by, well, only emitting declarations and type-checking, and otherwise passing to the next plugin to transform TSemitDeclarationOnly
overwrites output files with no content #268Details
when
emitDeclarationOnly
is set, only perform type-checking and emit declarations, don't transform TSresult.code
actually doesn't exist whenemitDeclarationOnly
is set anywayresult.code
isundefined
false
or do what we're doing now, which is likely more intuitive / intendedfalse
, but I'm not sure that's the most optimal behaviorbabel-plugin-typescript-to-proptypes
) or using for type-checking and declaration generation while using Vite / ESBuild for compilationadd a new paragraph to "Declarations" docs about this new feature and what it does and some examples of how it could be used
rollup-plugin-typescript2
while at it, also add a line about declaration maps
and reformat the existing paragraph a bit to match the style and improve readability
<br />
element to add a new-line within the paragraph for better readability / spacing<br />
Can see my root cause analysis in #268 (comment)