Skip to content

Commit 7913201

Browse files
committed
Merge remote-tracking branch 'remotes/origin/main' into api-readonly-mixin
# Conflicts: # apps/api-extractor/src/generators/ApiModelGenerator.ts # build-tests/install-test-workspace/workspace/common/pnpm-lock.yaml # common/reviews/api/api-extractor-model.api.md # libraries/api-extractor-model/src/model/ApiProperty.ts
2 parents a41f3fa + fd89af2 commit 7913201

File tree

272 files changed

+7254
-1127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

272 files changed

+7254
-1127
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ These GitHub repositories provide supplementary resources for Rush Stack:
6262
| [/libraries/debug-certificate-manager](./libraries/debug-certificate-manager/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fdebug-certificate-manager.svg)](https://badge.fury.io/js/%40rushstack%2Fdebug-certificate-manager) | [changelog](./libraries/debug-certificate-manager/CHANGELOG.md) | [@rushstack/debug-certificate-manager](https://www.npmjs.com/package/@rushstack/debug-certificate-manager) |
6363
| [/libraries/heft-config-file](./libraries/heft-config-file/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fheft-config-file.svg)](https://badge.fury.io/js/%40rushstack%2Fheft-config-file) | [changelog](./libraries/heft-config-file/CHANGELOG.md) | [@rushstack/heft-config-file](https://www.npmjs.com/package/@rushstack/heft-config-file) |
6464
| [/libraries/load-themed-styles](./libraries/load-themed-styles/) | [![npm version](https://badge.fury.io/js/%40microsoft%2Fload-themed-styles.svg)](https://badge.fury.io/js/%40microsoft%2Fload-themed-styles) | [changelog](./libraries/load-themed-styles/CHANGELOG.md) | [@microsoft/load-themed-styles](https://www.npmjs.com/package/@microsoft/load-themed-styles) |
65+
| [/libraries/localization-utilities](./libraries/localization-utilities/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Flocalization-utilities.svg)](https://badge.fury.io/js/%40rushstack%2Flocalization-utilities) | [changelog](./libraries/localization-utilities/CHANGELOG.md) | [@rushstack/localization-utilities](https://www.npmjs.com/package/@rushstack/localization-utilities) |
66+
| [/libraries/module-minifier](./libraries/module-minifier/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fmodule-minifier.svg)](https://badge.fury.io/js/%40rushstack%2Fmodule-minifier) | [changelog](./libraries/module-minifier/CHANGELOG.md) | [@rushstack/module-minifier](https://www.npmjs.com/package/@rushstack/module-minifier) |
6567
| [/libraries/node-core-library](./libraries/node-core-library/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fnode-core-library.svg)](https://badge.fury.io/js/%40rushstack%2Fnode-core-library) | [changelog](./libraries/node-core-library/CHANGELOG.md) | [@rushstack/node-core-library](https://www.npmjs.com/package/@rushstack/node-core-library) |
6668
| [/libraries/package-deps-hash](./libraries/package-deps-hash/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fpackage-deps-hash.svg)](https://badge.fury.io/js/%40rushstack%2Fpackage-deps-hash) | [changelog](./libraries/package-deps-hash/CHANGELOG.md) | [@rushstack/package-deps-hash](https://www.npmjs.com/package/@rushstack/package-deps-hash) |
6769
| [/libraries/rig-package](./libraries/rig-package/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Frig-package.svg)](https://badge.fury.io/js/%40rushstack%2Frig-package) | [changelog](./libraries/rig-package/CHANGELOG.md) | [@rushstack/rig-package](https://www.npmjs.com/package/@rushstack/rig-package) |
@@ -72,6 +74,7 @@ These GitHub repositories provide supplementary resources for Rush Stack:
7274
| [/libraries/tree-pattern](./libraries/tree-pattern/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Ftree-pattern.svg)](https://badge.fury.io/js/%40rushstack%2Ftree-pattern) | [changelog](./libraries/tree-pattern/CHANGELOG.md) | [@rushstack/tree-pattern](https://www.npmjs.com/package/@rushstack/tree-pattern) |
7375
| [/libraries/ts-command-line](./libraries/ts-command-line/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fts-command-line.svg)](https://badge.fury.io/js/%40rushstack%2Fts-command-line) | [changelog](./libraries/ts-command-line/CHANGELOG.md) | [@rushstack/ts-command-line](https://www.npmjs.com/package/@rushstack/ts-command-line) |
7476
| [/libraries/typings-generator](./libraries/typings-generator/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Ftypings-generator.svg)](https://badge.fury.io/js/%40rushstack%2Ftypings-generator) | [changelog](./libraries/typings-generator/CHANGELOG.md) | [@rushstack/typings-generator](https://www.npmjs.com/package/@rushstack/typings-generator) |
77+
| [/libraries/worker-pool](./libraries/worker-pool/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fworker-pool.svg)](https://badge.fury.io/js/%40rushstack%2Fworker-pool) | [changelog](./libraries/worker-pool/CHANGELOG.md) | [@rushstack/worker-pool](https://www.npmjs.com/package/@rushstack/worker-pool) |
7578
| [/rigs/heft-node-rig](./rigs/heft-node-rig/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fheft-node-rig.svg)](https://badge.fury.io/js/%40rushstack%2Fheft-node-rig) | [changelog](./rigs/heft-node-rig/CHANGELOG.md) | [@rushstack/heft-node-rig](https://www.npmjs.com/package/@rushstack/heft-node-rig) |
7679
| [/rigs/heft-web-rig](./rigs/heft-web-rig/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fheft-web-rig.svg)](https://badge.fury.io/js/%40rushstack%2Fheft-web-rig) | [changelog](./rigs/heft-web-rig/CHANGELOG.md) | [@rushstack/heft-web-rig](https://www.npmjs.com/package/@rushstack/heft-web-rig) |
7780
| [/rush-plugins/rush-amazon-s3-build-cache-plugin](./rush-plugins/rush-amazon-s3-build-cache-plugin/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Frush-amazon-s3-build-cache-plugin.svg)](https://badge.fury.io/js/%40rushstack%2Frush-amazon-s3-build-cache-plugin) | | [@rushstack/rush-amazon-s3-build-cache-plugin](https://www.npmjs.com/package/@rushstack/rush-amazon-s3-build-cache-plugin) |
@@ -82,6 +85,7 @@ These GitHub repositories provide supplementary resources for Rush Stack:
8285
| [/webpack/loader-raw-script](./webpack/loader-raw-script/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Floader-raw-script.svg)](https://badge.fury.io/js/%40rushstack%2Floader-raw-script) | [changelog](./webpack/loader-raw-script/CHANGELOG.md) | [@rushstack/loader-raw-script](https://www.npmjs.com/package/@rushstack/loader-raw-script) |
8386
| [/webpack/localization-plugin](./webpack/localization-plugin/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Flocalization-plugin.svg)](https://badge.fury.io/js/%40rushstack%2Flocalization-plugin) | [changelog](./webpack/localization-plugin/CHANGELOG.md) | [@rushstack/localization-plugin](https://www.npmjs.com/package/@rushstack/localization-plugin) |
8487
| [/webpack/module-minifier-plugin](./webpack/module-minifier-plugin/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fmodule-minifier-plugin.svg)](https://badge.fury.io/js/%40rushstack%2Fmodule-minifier-plugin) | [changelog](./webpack/module-minifier-plugin/CHANGELOG.md) | [@rushstack/module-minifier-plugin](https://www.npmjs.com/package/@rushstack/module-minifier-plugin) |
88+
| [/webpack/module-minifier-plugin-5](./webpack/module-minifier-plugin-5/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fwebpack5-module-minifier-plugin.svg)](https://badge.fury.io/js/%40rushstack%2Fwebpack5-module-minifier-plugin) | [changelog](./webpack/module-minifier-plugin-5/CHANGELOG.md) | [@rushstack/webpack5-module-minifier-plugin](https://www.npmjs.com/package/@rushstack/webpack5-module-minifier-plugin) |
8589
| [/webpack/preserve-dynamic-require-plugin](./webpack/preserve-dynamic-require-plugin/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fwebpack-preserve-dynamic-require-plugin.svg)](https://badge.fury.io/js/%40rushstack%2Fwebpack-preserve-dynamic-require-plugin) | [changelog](./webpack/preserve-dynamic-require-plugin/CHANGELOG.md) | [@rushstack/webpack-preserve-dynamic-require-plugin](https://www.npmjs.com/package/@rushstack/webpack-preserve-dynamic-require-plugin) |
8690
| [/webpack/set-webpack-public-path-plugin](./webpack/set-webpack-public-path-plugin/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fset-webpack-public-path-plugin.svg)](https://badge.fury.io/js/%40rushstack%2Fset-webpack-public-path-plugin) | [changelog](./webpack/set-webpack-public-path-plugin/CHANGELOG.md) | [@rushstack/set-webpack-public-path-plugin](https://www.npmjs.com/package/@rushstack/set-webpack-public-path-plugin) |
8791
| [/webpack/webpack-plugin-utilities](./webpack/webpack-plugin-utilities/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fwebpack-plugin-utilities.svg)](https://badge.fury.io/js/%40rushstack%2Fwebpack-plugin-utilities) | [changelog](./webpack/webpack-plugin-utilities/CHANGELOG.md) | [@rushstack/webpack-plugin-utilities](https://www.npmjs.com/package/@rushstack/webpack-plugin-utilities) |

apps/api-documenter/CHANGELOG.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,36 @@
11
{
22
"name": "@microsoft/api-documenter",
33
"entries": [
4+
{
5+
"version": "7.17.16",
6+
"tag": "@microsoft/api-documenter_v7.17.16",
7+
"date": "Wed, 25 May 2022 22:25:07 GMT",
8+
"comments": {
9+
"dependency": [
10+
{
11+
"comment": "Updating dependency \"@rushstack/heft\" to `0.45.5`"
12+
},
13+
{
14+
"comment": "Updating dependency \"@rushstack/heft-node-rig\" to `1.9.6`"
15+
}
16+
]
17+
}
18+
},
19+
{
20+
"version": "7.17.15",
21+
"tag": "@microsoft/api-documenter_v7.17.15",
22+
"date": "Thu, 19 May 2022 15:13:20 GMT",
23+
"comments": {
24+
"dependency": [
25+
{
26+
"comment": "Updating dependency \"@rushstack/heft\" to `0.45.4`"
27+
},
28+
{
29+
"comment": "Updating dependency \"@rushstack/heft-node-rig\" to `1.9.5`"
30+
}
31+
]
32+
}
33+
},
434
{
535
"version": "7.17.14",
636
"tag": "@microsoft/api-documenter_v7.17.14",

apps/api-documenter/CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
# Change Log - @microsoft/api-documenter
22

3-
This log was last generated on Sat, 14 May 2022 03:01:27 GMT and should not be manually modified.
3+
This log was last generated on Wed, 25 May 2022 22:25:07 GMT and should not be manually modified.
4+
5+
## 7.17.16
6+
Wed, 25 May 2022 22:25:07 GMT
7+
8+
_Version update only_
9+
10+
## 7.17.15
11+
Thu, 19 May 2022 15:13:20 GMT
12+
13+
_Version update only_
414

515
## 7.17.14
616
Sat, 14 May 2022 03:01:27 GMT

apps/api-documenter/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/api-documenter",
3-
"version": "7.17.14",
3+
"version": "7.17.16",
44
"description": "Read JSON files from api-extractor, generate documentation pages",
55
"repository": {
66
"type": "git",

apps/api-extractor/CHANGELOG.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
11
{
22
"name": "@microsoft/api-extractor",
33
"entries": [
4+
{
5+
"version": "7.24.2",
6+
"tag": "@microsoft/api-extractor_v7.24.2",
7+
"date": "Wed, 25 May 2022 22:25:07 GMT",
8+
"comments": {
9+
"patch": [
10+
{
11+
"comment": "Fix an issue where API Extractor would fail to run on a project where `\"moduleResolution\"` is set to `\"Node16\"` in `tsconfig.json`"
12+
}
13+
]
14+
}
15+
},
16+
{
17+
"version": "7.24.1",
18+
"tag": "@microsoft/api-extractor_v7.24.1",
19+
"date": "Thu, 19 May 2022 15:13:20 GMT",
20+
"comments": {
21+
"patch": [
22+
{
23+
"comment": "Fix a recent regression that produced an error \"Cannot read properties of undefined\" (GitHub #3423)"
24+
}
25+
]
26+
}
27+
},
428
{
529
"version": "7.24.0",
630
"tag": "@microsoft/api-extractor_v7.24.0",

apps/api-extractor/CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
# Change Log - @microsoft/api-extractor
22

3-
This log was last generated on Sat, 14 May 2022 03:01:27 GMT and should not be manually modified.
3+
This log was last generated on Wed, 25 May 2022 22:25:07 GMT and should not be manually modified.
4+
5+
## 7.24.2
6+
Wed, 25 May 2022 22:25:07 GMT
7+
8+
### Patches
9+
10+
- Fix an issue where API Extractor would fail to run on a project where `"moduleResolution"` is set to `"Node16"` in `tsconfig.json`
11+
12+
## 7.24.1
13+
Thu, 19 May 2022 15:13:20 GMT
14+
15+
### Patches
16+
17+
- Fix a recent regression that produced an error "Cannot read properties of undefined" (GitHub #3423)
418

519
## 7.24.0
620
Sat, 14 May 2022 03:01:27 GMT

apps/api-extractor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/api-extractor",
3-
"version": "7.24.0",
3+
"version": "7.24.2",
44
"description": "Analyze the exported API for a TypeScript library and generate reviews, documentation, and .d.ts rollups",
55
"keywords": [
66
"typescript",

apps/api-extractor/src/analyzer/ExportAnalyzer.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,18 @@ export class ExportAnalyzer {
259259
importOrExportDeclaration: ts.ImportDeclaration | ts.ExportDeclaration | ts.ImportTypeNode,
260260
moduleSpecifier: string
261261
): boolean {
262+
const specifier: ts.TypeNode | ts.Expression | undefined = ts.isImportTypeNode(importOrExportDeclaration)
263+
? importOrExportDeclaration.argument
264+
: importOrExportDeclaration.moduleSpecifier;
265+
const mode: ts.ModuleKind.CommonJS | ts.ModuleKind.ESNext | undefined =
266+
specifier && ts.isStringLiteralLike(specifier)
267+
? TypeScriptInternals.getModeForUsageLocation(importOrExportDeclaration.getSourceFile(), specifier)
268+
: undefined;
269+
262270
const resolvedModule: ts.ResolvedModuleFull | undefined = TypeScriptInternals.getResolvedModule(
263271
importOrExportDeclaration.getSourceFile(),
264-
moduleSpecifier
272+
moduleSpecifier,
273+
mode
265274
);
266275

267276
if (resolvedModule === undefined) {
@@ -863,9 +872,18 @@ export class ExportAnalyzer {
863872
exportSymbol: ts.Symbol
864873
): AstModule {
865874
const moduleSpecifier: string = this._getModuleSpecifier(importOrExportDeclaration);
875+
const mode: ts.ModuleKind.CommonJS | ts.ModuleKind.ESNext | undefined =
876+
importOrExportDeclaration.moduleSpecifier &&
877+
ts.isStringLiteralLike(importOrExportDeclaration.moduleSpecifier)
878+
? TypeScriptInternals.getModeForUsageLocation(
879+
importOrExportDeclaration.getSourceFile(),
880+
importOrExportDeclaration.moduleSpecifier
881+
)
882+
: undefined;
866883
const resolvedModule: ts.ResolvedModuleFull | undefined = TypeScriptInternals.getResolvedModule(
867884
importOrExportDeclaration.getSourceFile(),
868-
moduleSpecifier
885+
moduleSpecifier,
886+
mode
869887
);
870888

871889
if (resolvedModule === undefined) {

apps/api-extractor/src/analyzer/TypeScriptInternals.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,26 @@ export class TypeScriptInternals {
8383
*/
8484
public static getResolvedModule(
8585
sourceFile: ts.SourceFile,
86-
moduleNameText: string
86+
moduleNameText: string,
87+
mode: ts.ModuleKind.CommonJS | ts.ModuleKind.ESNext | undefined
8788
): ts.ResolvedModuleFull | undefined {
8889
// Compiler internal:
89-
// https://github.com/microsoft/TypeScript/blob/v3.2.2/src/compiler/utilities.ts#L218
90+
// https://github.com/microsoft/TypeScript/blob/v4.7.2/src/compiler/utilities.ts#L161
9091

91-
return (ts as any).getResolvedModule(sourceFile, moduleNameText);
92+
return (ts as any).getResolvedModule(sourceFile, moduleNameText, mode);
93+
}
94+
95+
/**
96+
* Gets the mode required for module resolution required with the addition of Node16/nodenext
97+
*/
98+
public static getModeForUsageLocation(
99+
file: { impliedNodeFormat?: ts.SourceFile['impliedNodeFormat'] },
100+
usage: ts.StringLiteralLike | undefined
101+
): ts.ModuleKind.CommonJS | ts.ModuleKind.ESNext | undefined {
102+
// Compiler internal:
103+
// https://github.com/microsoft/TypeScript/blob/v4.7.2/src/compiler/program.ts#L568
104+
105+
return (ts as any).getModeForUsageLocation?.(file, usage);
92106
}
93107

94108
/**

apps/api-extractor/src/generators/ApiModelGenerator.ts

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import { DeclarationMetadata } from '../collector/DeclarationMetadata';
4343
import { AstNamespaceImport } from '../analyzer/AstNamespaceImport';
4444
import { AstEntity } from '../analyzer/AstEntity';
4545
import { AstModule } from '../analyzer/AstModule';
46-
4746
import { TypeScriptInternals } from '../analyzer/TypeScriptInternals';
4847

4948
export class ApiModelGenerator {
@@ -336,10 +335,12 @@ export class ApiModelGenerator {
336335
const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
337336
const docComment: tsdoc.DocComment | undefined = apiItemMetadata.tsdocComment;
338337
const releaseTag: ReleaseTag = apiItemMetadata.effectiveReleaseTag;
338+
const isProtected: boolean = (astDeclaration.modifierFlags & ts.ModifierFlags.Protected) !== 0;
339339

340340
apiConstructor = new ApiConstructor({
341341
docComment,
342342
releaseTag,
343+
isProtected,
343344
parameters,
344345
overloadIndex,
345346
excerptTokens
@@ -711,11 +712,13 @@ export class ApiModelGenerator {
711712
}
712713
const isOptional: boolean =
713714
(astDeclaration.astSymbol.followedSymbol.flags & ts.SymbolFlags.Optional) !== 0;
715+
const isProtected: boolean = (astDeclaration.modifierFlags & ts.ModifierFlags.Protected) !== 0;
714716

715717
apiMethod = new ApiMethod({
716718
name,
717719
docComment,
718720
releaseTag,
721+
isProtected,
719722
isStatic,
720723
isOptional,
721724
typeParameters,
@@ -826,13 +829,20 @@ export class ApiModelGenerator {
826829
const nodesToCapture: IExcerptBuilderNodeToCapture[] = [];
827830

828831
const propertyTypeTokenRange: IExcerptTokenRange = ExcerptBuilder.createEmptyTokenRange();
832+
let propertyTypeNode: ts.TypeNode | undefined;
833+
834+
if (
835+
ts.isPropertyDeclaration(astDeclaration.declaration) ||
836+
ts.isGetAccessorDeclaration(astDeclaration.declaration)
837+
) {
838+
propertyTypeNode = astDeclaration.declaration.type;
839+
}
840+
841+
if (ts.isSetAccessorDeclaration(astDeclaration.declaration)) {
842+
// Note that TypeScript always reports an error if a setter does not have exactly one parameter.
843+
propertyTypeNode = astDeclaration.declaration.parameters[0].type;
844+
}
829845

830-
// If the property declaration's type is `undefined`, then we're processing a setter with no corresponding
831-
// getter. Use the parameter type instead (note that TypeScript always reports an error if a setter
832-
// does not have exactly one parameter).
833-
const propertyTypeNode: ts.TypeNode | undefined =
834-
(astDeclaration.declaration as ts.PropertyDeclaration | ts.GetAccessorDeclaration).type ||
835-
(astDeclaration.declaration as ts.SetAccessorDeclaration).parameters[0].type;
836846
nodesToCapture.push({ node: propertyTypeNode, tokenRange: propertyTypeTokenRange });
837847

838848
const excerptTokens: IExcerptToken[] = this._buildExcerptTokens(astDeclaration, nodesToCapture);
@@ -841,12 +851,14 @@ export class ApiModelGenerator {
841851
const releaseTag: ReleaseTag = apiItemMetadata.effectiveReleaseTag;
842852
const isOptional: boolean =
843853
(astDeclaration.astSymbol.followedSymbol.flags & ts.SymbolFlags.Optional) !== 0;
854+
const isProtected: boolean = (astDeclaration.modifierFlags & ts.ModifierFlags.Protected) !== 0;
844855
const isReadonly: boolean = this._determineReadonly(astDeclaration);
845856

846857
apiProperty = new ApiProperty({
847858
name,
848859
docComment,
849860
releaseTag,
861+
isProtected,
850862
isStatic,
851863
isOptional,
852864
isReadonly,
@@ -976,7 +988,14 @@ export class ApiModelGenerator {
976988
const releaseTag: ReleaseTag = apiItemMetadata.effectiveReleaseTag;
977989
const isReadonly: boolean = this._determineReadonly(astDeclaration);
978990

979-
apiVariable = new ApiVariable({ name, docComment, releaseTag, excerptTokens, variableTypeTokenRange, isReadonly });
991+
apiVariable = new ApiVariable({
992+
name,
993+
docComment,
994+
releaseTag,
995+
excerptTokens,
996+
variableTypeTokenRange,
997+
isReadonly
998+
});
980999

9811000
parentApiItem.addMember(apiVariable);
9821001
}
@@ -1058,9 +1077,13 @@ export class ApiModelGenerator {
10581077
//Line 2: sees if the TSDoc comment for @readonly is present
10591078
//Line 3: sees whether a getter is present for a property with no setter
10601079
//Line 4: sees if the var declaration has Const keyword
1061-
return (astDeclaration.modifierFlags & (ts.ModifierFlags.Readonly + ts.ModifierFlags.Const)) !== 0
1062-
|| (docComment !== undefined && docComment.modifierTagSet.hasTagName('@readonly'))
1063-
|| (declarationMetadata.ancillaryDeclarations.length === 0 && astDeclaration.declaration.kind === ts.SyntaxKind.GetAccessor)
1064-
|| ts.isVariableDeclaration(astDeclaration.declaration) && TypeScriptInternals.isVarConst(astDeclaration.declaration)
1080+
return (
1081+
(astDeclaration.modifierFlags & (ts.ModifierFlags.Readonly + ts.ModifierFlags.Const)) !== 0 ||
1082+
(docComment !== undefined && docComment.modifierTagSet.hasTagName('@readonly')) ||
1083+
(declarationMetadata.ancillaryDeclarations.length === 0 &&
1084+
astDeclaration.declaration.kind === ts.SyntaxKind.GetAccessor) ||
1085+
(ts.isVariableDeclaration(astDeclaration.declaration) &&
1086+
TypeScriptInternals.isVarConst(astDeclaration.declaration))
1087+
);
10651088
}
10661089
}

0 commit comments

Comments
 (0)