From 5401ac687cd0dd745f78efc7429d2e5118512394 Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 6 Mar 2025 17:30:59 -0500 Subject: [PATCH] doc: recommend setting `noEmit: true` in `tsconfig.json` PR-URL: https://github.com/nodejs/node/pull/57320 Fixes: https://github.com/nodejs/node/issues/57294 Reviewed-By: Marco Ippolito Reviewed-By: Moshe Atlow --- doc/api/typescript.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/api/typescript.md b/doc/api/typescript.md index 04de1e99776..6a5d1d1dbc6 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 - see note below "target": "esnext", "module": "nodenext", "rewriteRelativeImportExtensions": true, @@ -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. + ### Determining module system Node.js supports both [CommonJS][] and [ES Modules][] syntax in TypeScript