Skip to content

Commit eb430f2

Browse files
authored
More documentation on the impliedNodeFormat SourceFile field (#49816)
1 parent af70f24 commit eb430f2

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

src/compiler/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3791,6 +3791,12 @@ namespace ts {
37913791
* It is _public_ so that (pre)transformers can set this field,
37923792
* since it switches the builtin `node` module transform. Generally speaking, if unset,
37933793
* the field is treated as though it is `ModuleKind.CommonJS`.
3794+
*
3795+
* Note that this field is only set by the module resolution process when
3796+
* `moduleResolution` is `Node16` or `NodeNext`, which is implied by the `module` setting
3797+
* of `Node16` or `NodeNext`, respectively, but may be overriden (eg, by a `moduleResolution`
3798+
* of `node`). If so, this field will be unset and source files will be considered to be
3799+
* CommonJS-output-format by the node module transformer and type checker, regardless of extension or context.
37943800
*/
37953801
impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS;
37963802

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,6 +2096,12 @@ declare namespace ts {
20962096
* It is _public_ so that (pre)transformers can set this field,
20972097
* since it switches the builtin `node` module transform. Generally speaking, if unset,
20982098
* the field is treated as though it is `ModuleKind.CommonJS`.
2099+
*
2100+
* Note that this field is only set by the module resolution process when
2101+
* `moduleResolution` is `Node16` or `NodeNext`, which is implied by the `module` setting
2102+
* of `Node16` or `NodeNext`, respectively, but may be overriden (eg, by a `moduleResolution`
2103+
* of `node`). If so, this field will be unset and source files will be considered to be
2104+
* CommonJS-output-format by the node module transformer and type checker, regardless of extension or context.
20992105
*/
21002106
impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS;
21012107
}

tests/baselines/reference/api/typescript.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,6 +2096,12 @@ declare namespace ts {
20962096
* It is _public_ so that (pre)transformers can set this field,
20972097
* since it switches the builtin `node` module transform. Generally speaking, if unset,
20982098
* the field is treated as though it is `ModuleKind.CommonJS`.
2099+
*
2100+
* Note that this field is only set by the module resolution process when
2101+
* `moduleResolution` is `Node16` or `NodeNext`, which is implied by the `module` setting
2102+
* of `Node16` or `NodeNext`, respectively, but may be overriden (eg, by a `moduleResolution`
2103+
* of `node`). If so, this field will be unset and source files will be considered to be
2104+
* CommonJS-output-format by the node module transformer and type checker, regardless of extension or context.
20992105
*/
21002106
impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS;
21012107
}

0 commit comments

Comments
 (0)