From cbe09b579fb72aa996df553a561c62f969801ac5 Mon Sep 17 00:00:00 2001 From: Carlos Espa <43477095+Ceres6@users.noreply.github.com> Date: Fri, 8 Nov 2024 11:28:40 +0100 Subject: [PATCH] doc: add path aliases typescript doc PR-URL: https://github.com/nodejs/node/pull/55766 Reviewed-By: Marco Ippolito Reviewed-By: Jacob Smith Reviewed-By: Paolo Insogna --- doc/api/typescript.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/api/typescript.md b/doc/api/typescript.md index c6dfb774c3f068..d2680670a5f316 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 + +[`tsconfig` "paths"][] won't be transformed and therefore produce an error. The closest +feature available is [subpath imports][] with the limitation that they need to start +with `#`. + [CommonJS]: modules.md [ES Modules]: esm.md [Full TypeScript support]: #full-typescript-support [`--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 [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