From 958d480636d73b4046b43efea305f464c21eb29a Mon Sep 17 00:00:00 2001 From: Carlos Espa Date: Thu, 7 Nov 2024 16:07:18 +0100 Subject: [PATCH 1/3] doc: add path aliases typescript doc --- doc/api/typescript.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/api/typescript.md b/doc/api/typescript.md index c6dfb774c3f068..db5f92d994739d 100644 --- a/doc/api/typescript.md +++ b/doc/api/typescript.md @@ -172,14 +172,22 @@ To discourage package authors from publishing packages written in TypeScript, Node.js will by default refuse to handle TypeScript files inside folders under a `node_modules` path. +### Paths aliases + +[Path aliases][] won't be transformed and therefore produce an error. The closest +feature available are [subpath imports][] with the limitation that they need to start +with `#` + [CommonJS]: modules.md [ES Modules]: esm.md [Full TypeScript support]: #full-typescript-support +[Path aliases]: https://www.typescriptlang.org/tsconfig/#paths [`--experimental-strip-types`]: cli.md#--experimental-strip-types [`--experimental-transform-types`]: cli.md#--experimental-transform-types [`tsx`]: https://tsx.is/ [`verbatimModuleSyntax`]: https://www.typescriptlang.org/tsconfig/#verbatimModuleSyntax [file extensions are mandatory]: esm.md#mandatory-file-extensions [full support]: #full-typescript-support +[subpath imports]: packages.md#subpath-imports [the same way as `.js` files.]: packages.md#determining-module-system [type stripping]: #type-stripping From eda521d7f39af9d6eea5076038bc49b84a628d7b Mon Sep 17 00:00:00 2001 From: Carlos Espa Date: Thu, 7 Nov 2024 21:17:09 +0100 Subject: [PATCH 2/3] fixup! doc: add path aliases typescript doc --- doc/api/typescript.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/typescript.md b/doc/api/typescript.md index db5f92d994739d..7a210f8570500d 100644 --- a/doc/api/typescript.md +++ b/doc/api/typescript.md @@ -174,16 +174,16 @@ a `node_modules` path. ### Paths aliases -[Path aliases][] won't be transformed and therefore produce an error. The closest +[`tsconfig` "paths"][] won't be transformed and therefore produce an error. The closest feature available are [subpath imports][] with the limitation that they need to start with `#` [CommonJS]: modules.md [ES Modules]: esm.md [Full TypeScript support]: #full-typescript-support -[Path aliases]: https://www.typescriptlang.org/tsconfig/#paths [`--experimental-strip-types`]: cli.md#--experimental-strip-types [`--experimental-transform-types`]: cli.md#--experimental-transform-types +[`tsconfig` "paths"]: https://www.typescriptlang.org/tsconfig/#paths [`tsx`]: https://tsx.is/ [`verbatimModuleSyntax`]: https://www.typescriptlang.org/tsconfig/#verbatimModuleSyntax [file extensions are mandatory]: esm.md#mandatory-file-extensions From a614f831da4c0da046d177643e11a2cb1b3318b3 Mon Sep 17 00:00:00 2001 From: Carlos Espa <43477095+Ceres6@users.noreply.github.com> Date: Fri, 8 Nov 2024 10:40:11 +0100 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com> --- doc/api/typescript.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/typescript.md b/doc/api/typescript.md index 7a210f8570500d..d2680670a5f316 100644 --- a/doc/api/typescript.md +++ b/doc/api/typescript.md @@ -175,8 +175,8 @@ a `node_modules` path. ### Paths aliases [`tsconfig` "paths"][] won't be transformed and therefore produce an error. The closest -feature available are [subpath imports][] with the limitation that they need to start -with `#` +feature available is [subpath imports][] with the limitation that they need to start +with `#`. [CommonJS]: modules.md [ES Modules]: esm.md