From fb5acdd6b47a67604e069db90aed7ef90851a751 Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 4 Mar 2025 17:24:30 -0500 Subject: [PATCH 1/2] doc: recommend setting `noEmit: true` in `tsconfig.json` --- doc/api/typescript.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/api/typescript.md b/doc/api/typescript.md index 04de1e99776230..6bca5b2760a6da 100644 --- a/doc/api/typescript.md +++ b/doc/api/typescript.md @@ -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 "target": "esnext", "module": "nodenext", "rewriteRelativeImportExtensions": true, From 839322d1063179155e803527d417150af03b3e14 Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 6 Mar 2025 11:20:52 -0500 Subject: [PATCH 2/2] doc: add note below code snippet --- doc/api/typescript.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/api/typescript.md b/doc/api/typescript.md index 6bca5b2760a6da..6a5d1d1dbc6ebd 100644 --- a/doc/api/typescript.md +++ b/doc/api/typescript.md @@ -81,7 +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 + "noEmit": true, // Optional - see note below "target": "esnext", "module": "nodenext", "rewriteRelativeImportExtensions": true, @@ -91,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. + ### Determining module system Node.js supports both [CommonJS][] and [ES Modules][] syntax in TypeScript