-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
doc: recommend setting noEmit: true
in tsconfig.json
#57320
Conversation
Review requested:
|
doc/api/typescript.md
Outdated
@@ -81,6 +81,7 @@ but we recommend version 5.8 or newer with the following `tsconfig.json` setting | |||
```json | |||
{ | |||
"compilerOptions": { | |||
"noEmit": true, // Optional - prevent tsc from emitting transpiled JS |
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.
The current wording is a literal description of the tsconfig flag - which can be independently googled. I think the added value we can bring here in the docs is to explain why you might want to use it. For example...
"noEmit": true, // Optional - prevent tsc from emitting transpiled JS | |
"noEmit": true, // Optional - see Note (1) | |
... | |
Note (1): `"noEmit"` is useful if your code is only intended to be consumed and executed as `*.ts` files. If instead you need to produce `*.js` files for performance or distribution reasons, you won't need this flag. |
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.
Added a variation of this in 839322d
@@ -90,6 +91,10 @@ but we recommend version 5.8 or newer with the following `tsconfig.json` setting | |||
} | |||
``` | |||
|
|||
> \[!NOTE] | |||
> Use the `noEmit` option if you intend to only execute `*.ts` files, for example a build script. | |||
> You won't need this flag if you intend to distribute `*.js` files for performance reasons. |
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.
> You won't need this flag if you intend to distribute `*.js` files for performance reasons. | |
> You won't need this flag if you intend to distribute `*.js` files. |
for whatever reason like npm package
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.
Sounds good to me. I created a new PR since this one already merged.
Landed in 5401ac6 |
noEmit: true
from defaulttsconfig.json
in type stripping docs #57294