Skip to content

Commit

Permalink
More documentation on the impliedNodeFormat SourceFile field (#49816)
Browse files Browse the repository at this point in the history
  • Loading branch information
weswigham committed Jul 6, 2022
1 parent af70f24 commit eb430f2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 6 additions & 0 deletions tests/baselines/reference/api/tsserverlibrary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions tests/baselines/reference/api/typescript.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit eb430f2

Please sign in to comment.