diff --git a/src/compiler/types.ts b/src/compiler/types.ts index fd7abdee8bc1c..f93f36c369157 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3791,6 +3791,12 @@ namespace ts { * It is _public_ so that (pre)transformers can set this field, * since it switches the builtin `node` module transform. Generally speaking, if unset, * the field is treated as though it is `ModuleKind.CommonJS`. + * + * Note that this field is only set by the module resolution process when + * `moduleResolution` is `Node16` or `NodeNext`, which is implied by the `module` setting + * of `Node16` or `NodeNext`, respectively, but may be overriden (eg, by a `moduleResolution` + * of `node`). If so, this field will be unset and source files will be considered to be + * CommonJS-output-format by the node module transformer and type checker, regardless of extension or context. */ impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 8f78675d2b5f6..23bfc30ee197c 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2096,6 +2096,12 @@ declare namespace ts { * It is _public_ so that (pre)transformers can set this field, * since it switches the builtin `node` module transform. Generally speaking, if unset, * the field is treated as though it is `ModuleKind.CommonJS`. + * + * Note that this field is only set by the module resolution process when + * `moduleResolution` is `Node16` or `NodeNext`, which is implied by the `module` setting + * of `Node16` or `NodeNext`, respectively, but may be overriden (eg, by a `moduleResolution` + * of `node`). If so, this field will be unset and source files will be considered to be + * CommonJS-output-format by the node module transformer and type checker, regardless of extension or context. */ impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS; } diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index d52463cf85dc8..18ef4ee23f826 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2096,6 +2096,12 @@ declare namespace ts { * It is _public_ so that (pre)transformers can set this field, * since it switches the builtin `node` module transform. Generally speaking, if unset, * the field is treated as though it is `ModuleKind.CommonJS`. + * + * Note that this field is only set by the module resolution process when + * `moduleResolution` is `Node16` or `NodeNext`, which is implied by the `module` setting + * of `Node16` or `NodeNext`, respectively, but may be overriden (eg, by a `moduleResolution` + * of `node`). If so, this field will be unset and source files will be considered to be + * CommonJS-output-format by the node module transformer and type checker, regardless of extension or context. */ impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS; }