Skip to content

More documentation on the impliedNodeFormat SourceFile field #49816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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