typescript 4.5.0-dev.20211022 → 4.5.0-dev.20211026

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20211022";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20211026";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -8335,6 +8335,7 @@ var ts;
8335
8335
  Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1387, ts.DiagnosticCategory.Error, "Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387", "Function type notation must be parenthesized when used in an intersection type."),
8336
8336
  Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1388, ts.DiagnosticCategory.Error, "Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1388", "Constructor type notation must be parenthesized when used in an intersection type."),
8337
8337
  _0_is_not_allowed_as_a_variable_declaration_name: diag(1389, ts.DiagnosticCategory.Error, "_0_is_not_allowed_as_a_variable_declaration_name_1389", "'{0}' is not allowed as a variable declaration name."),
8338
+ _0_is_not_allowed_as_a_parameter_name: diag(1390, ts.DiagnosticCategory.Error, "_0_is_not_allowed_as_a_parameter_name_1390", "'{0}' is not allowed as a parameter name."),
8338
8339
  An_import_alias_cannot_use_import_type: diag(1392, ts.DiagnosticCategory.Error, "An_import_alias_cannot_use_import_type_1392", "An import alias cannot use 'import type'"),
8339
8340
  Imported_via_0_from_file_1: diag(1393, ts.DiagnosticCategory.Message, "Imported_via_0_from_file_1_1393", "Imported via {0} from file '{1}'"),
8340
8341
  Imported_via_0_from_file_1_with_packageId_2: diag(1394, ts.DiagnosticCategory.Message, "Imported_via_0_from_file_1_with_packageId_2_1394", "Imported via {0} from file '{1}' with packageId '{2}'"),
@@ -32127,7 +32128,10 @@ var ts;
32127
32128
  case 12 /* ObjectLiteralMembers */: return parseErrorAtCurrentToken(ts.Diagnostics.Property_assignment_expected);
32128
32129
  case 15 /* ArrayLiteralMembers */: return parseErrorAtCurrentToken(ts.Diagnostics.Expression_or_comma_expected);
32129
32130
  case 17 /* JSDocParameters */: return parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
32130
- case 16 /* Parameters */: return parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
32131
+ case 16 /* Parameters */:
32132
+ return ts.isKeyword(token())
32133
+ ? parseErrorAtCurrentToken(ts.Diagnostics._0_is_not_allowed_as_a_parameter_name, ts.tokenToString(token()))
32134
+ : parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
32131
32135
  case 19 /* TypeParameters */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_parameter_declaration_expected);
32132
32136
  case 20 /* TypeArguments */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_argument_expected);
32133
32137
  case 21 /* TupleElementTypes */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_expected);
@@ -45887,6 +45891,7 @@ var ts;
45887
45891
  case 168 /* MethodDeclaration */:
45888
45892
  case 171 /* GetAccessor */:
45889
45893
  case 172 /* SetAccessor */:
45894
+ case 169 /* ClassStaticBlockDeclaration */:
45890
45895
  // this.foo assignment in a JavaScript class
45891
45896
  // Bind this property to the containing class
45892
45897
  var containingClass = thisContainer.parent;
@@ -49597,21 +49602,28 @@ var ts;
49597
49602
  var namespaceName = getFullyQualifiedName(namespace);
49598
49603
  var declarationName = ts.declarationNameToString(right);
49599
49604
  var suggestionForNonexistentModule = getSuggestedSymbolForNonexistentModule(right, namespace);
49600
- var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
49601
- var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
49602
- var canSuggestTypeof = containingQualifiedName && !ts.isTypeOfExpression(containingQualifiedName.parent) && tryGetQualifiedNameAsValue(containingQualifiedName);
49603
49605
  if (suggestionForNonexistentModule) {
49604
49606
  error(right, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule));
49607
+ return undefined;
49605
49608
  }
49606
- else if (canSuggestTypeof) {
49609
+ var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
49610
+ var canSuggestTypeof = globalObjectType // <-- can't pull on types if global types aren't initialized yet
49611
+ && (meaning & 788968 /* Type */)
49612
+ && containingQualifiedName
49613
+ && !ts.isTypeOfExpression(containingQualifiedName.parent)
49614
+ && tryGetQualifiedNameAsValue(containingQualifiedName);
49615
+ if (canSuggestTypeof) {
49607
49616
  error(containingQualifiedName, ts.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, ts.entityNameToString(containingQualifiedName));
49617
+ return undefined;
49608
49618
  }
49609
- else if (meaning & 1920 /* Namespace */ && exportedTypeSymbol && ts.isQualifiedName(name.parent)) {
49610
- error(name.parent.right, ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, symbolToString(exportedTypeSymbol), ts.unescapeLeadingUnderscores(name.parent.right.escapedText));
49611
- }
49612
- else {
49613
- error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
49619
+ if (meaning & 1920 /* Namespace */ && ts.isQualifiedName(name.parent)) {
49620
+ var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
49621
+ if (exportedTypeSymbol) {
49622
+ error(name.parent.right, ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, symbolToString(exportedTypeSymbol), ts.unescapeLeadingUnderscores(name.parent.right.escapedText));
49623
+ return undefined;
49624
+ }
49614
49625
  }
49626
+ error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
49615
49627
  }
49616
49628
  return undefined;
49617
49629
  }
@@ -49947,8 +49959,8 @@ var ts;
49947
49959
  if (exportEquals !== moduleSymbol) {
49948
49960
  var type = getTypeOfSymbol(exportEquals);
49949
49961
  if (shouldTreatPropertiesOfExternalModuleAsExports(type)) {
49950
- getPropertiesOfType(type).forEach(function (symbol) {
49951
- cb(symbol, symbol.escapedName);
49962
+ forEachPropertyOfType(type, function (symbol, escapedName) {
49963
+ cb(symbol, escapedName);
49952
49964
  });
49953
49965
  }
49954
49966
  }
@@ -50280,12 +50292,15 @@ var ts;
50280
50292
  function getNamedMembers(members) {
50281
50293
  var result;
50282
50294
  members.forEach(function (symbol, id) {
50283
- if (!isReservedMemberName(id) && symbolIsValue(symbol)) {
50295
+ if (isNamedMember(symbol, id)) {
50284
50296
  (result || (result = [])).push(symbol);
50285
50297
  }
50286
50298
  });
50287
50299
  return result || ts.emptyArray;
50288
50300
  }
50301
+ function isNamedMember(member, escapedName) {
50302
+ return !isReservedMemberName(escapedName) && symbolIsValue(member);
50303
+ }
50289
50304
  function getNamedOrIndexSignatureMembers(members) {
50290
50305
  var result = getNamedMembers(members);
50291
50306
  var index = getIndexSymbolFromSymbolTable(members);
@@ -57118,6 +57133,16 @@ var ts;
57118
57133
  getPropertiesOfUnionOrIntersectionType(type) :
57119
57134
  getPropertiesOfObjectType(type);
57120
57135
  }
57136
+ function forEachPropertyOfType(type, action) {
57137
+ type = getReducedApparentType(type);
57138
+ if (type.flags & 3670016 /* StructuredType */) {
57139
+ resolveStructuredTypeMembers(type).members.forEach(function (symbol, escapedName) {
57140
+ if (isNamedMember(symbol, escapedName)) {
57141
+ action(symbol, escapedName);
57142
+ }
57143
+ });
57144
+ }
57145
+ }
57121
57146
  function isTypeInvalidDueToUnionDiscriminant(contextualType, obj) {
57122
57147
  var list = obj.properties;
57123
57148
  return list.some(function (property) {
@@ -60901,13 +60926,14 @@ var ts;
60901
60926
  }
60902
60927
  return result;
60903
60928
  }
60929
+ function isDistributionDependent(root) {
60930
+ return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
60931
+ isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
60932
+ }
60904
60933
  function getTypeFromConditionalTypeNode(node) {
60905
60934
  var links = getNodeLinks(node);
60906
60935
  if (!links.resolvedType) {
60907
60936
  var checkType = getTypeFromTypeNode(node.checkType);
60908
- var isDistributive = !!(checkType.flags & 262144 /* TypeParameter */);
60909
- var isDistributionDependent = isDistributive && (isTypeParameterPossiblyReferenced(checkType, node.trueType) ||
60910
- isTypeParameterPossiblyReferenced(checkType, node.falseType));
60911
60937
  var aliasSymbol = getAliasSymbolForTypeNode(node);
60912
60938
  var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
60913
60939
  var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
@@ -60916,8 +60942,7 @@ var ts;
60916
60942
  node: node,
60917
60943
  checkType: checkType,
60918
60944
  extendsType: getTypeFromTypeNode(node.extendsType),
60919
- isDistributive: isDistributive,
60920
- isDistributionDependent: isDistributionDependent,
60945
+ isDistributive: !!(checkType.flags & 262144 /* TypeParameter */),
60921
60946
  inferTypeParameters: getInferTypeParameters(node),
60922
60947
  outerTypeParameters: outerTypeParameters,
60923
60948
  instantiations: undefined,
@@ -64064,7 +64089,7 @@ var ts;
64064
64089
  // We check for a relationship to a conditional type target only when the conditional type has no
64065
64090
  // 'infer' positions and is not distributive or is distributive but doesn't reference the check type
64066
64091
  // parameter in either of the result types.
64067
- if (!c.root.inferTypeParameters && !c.root.isDistributionDependent) {
64092
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
64068
64093
  // Check if the conditional is always true or always false but still deferred for distribution purposes.
64069
64094
  var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
64070
64095
  var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
@@ -126146,10 +126171,14 @@ var ts;
126146
126171
  }
126147
126172
  var isDefault = exportKind === 1 /* Default */;
126148
126173
  var namedSymbol = isDefault && ts.getLocalSymbolForExportDefault(symbol) || symbol;
126149
- // A re-export merged with an export from a module augmentation can result in `symbol`
126150
- // being an external module symbol; the name it is re-exported by will be `symbolTableKey`
126151
- // (which comes from the keys of `moduleSymbol.exports`.)
126152
- var importedName = ts.isExternalModuleSymbol(namedSymbol)
126174
+ // 1. A named export must be imported by its key in `moduleSymbol.exports` or `moduleSymbol.members`.
126175
+ // 2. A re-export merged with an export from a module augmentation can result in `symbol`
126176
+ // being an external module symbol; the name it is re-exported by will be `symbolTableKey`
126177
+ // (which comes from the keys of `moduleSymbol.exports`.)
126178
+ // 3. Otherwise, we have a default/namespace import that can be imported by any name, and
126179
+ // `symbolTableKey` will be something undesirable like `export=` or `default`, so we try to
126180
+ // get a better name.
126181
+ var importedName = exportKind === 0 /* Named */ || ts.isExternalModuleSymbol(namedSymbol)
126153
126182
  ? ts.unescapeLeadingUnderscores(symbolTableKey)
126154
126183
  : ts.getNameForExportedSymbol(namedSymbol, scriptTarget);
126155
126184
  var moduleName = ts.stripQuotes(moduleSymbol.name);
@@ -126380,7 +126409,7 @@ var ts;
126380
126409
  cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, scriptTarget, checker);
126381
126410
  }
126382
126411
  checker.forEachExportAndPropertyOfModule(moduleSymbol, function (exported, key) {
126383
- if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, exported)) {
126412
+ if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
126384
126413
  cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, scriptTarget, checker);
126385
126414
  }
126386
126415
  });
@@ -129235,8 +129264,8 @@ var ts;
129235
129264
  }
129236
129265
  var checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker();
129237
129266
  var moduleSymbol = origin.moduleSymbol;
129238
- var exportedSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
129239
- var _b = ts.codefix.getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions)), host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _b.moduleSpecifier, codeAction = _b.codeAction;
129267
+ var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
129268
+ var _b = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions)), host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _b.moduleSpecifier, codeAction = _b.codeAction;
129240
129269
  ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier);
129241
129270
  return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] };
129242
129271
  }
@@ -130131,8 +130160,9 @@ var ts;
130131
130160
  function isNewIdentifierDefinitionLocation() {
130132
130161
  if (contextToken) {
130133
130162
  var containingNodeKind = contextToken.parent.kind;
130163
+ var tokenKind = keywordForNode(contextToken);
130134
130164
  // Previous token may have been a keyword that was converted to an identifier.
130135
- switch (keywordForNode(contextToken)) {
130165
+ switch (tokenKind) {
130136
130166
  case 27 /* CommaToken */:
130137
130167
  return containingNodeKind === 207 /* CallExpression */ // func( a, |
130138
130168
  || containingNodeKind === 170 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
@@ -130167,10 +130197,14 @@ var ts;
130167
130197
  return containingNodeKind === 222 /* TemplateExpression */; // `aa ${|
130168
130198
  case 16 /* TemplateMiddle */:
130169
130199
  return containingNodeKind === 232 /* TemplateSpan */; // `aa ${10} dd ${|
130170
- case 123 /* PublicKeyword */:
130171
- case 121 /* PrivateKeyword */:
130172
- case 122 /* ProtectedKeyword */:
130173
- return containingNodeKind === 166 /* PropertyDeclaration */; // class A{ public |
130200
+ case 131 /* AsyncKeyword */:
130201
+ return containingNodeKind === 168 /* MethodDeclaration */ // const obj = { async c|()
130202
+ || containingNodeKind === 295 /* ShorthandPropertyAssignment */; // const obj = { async c|
130203
+ case 41 /* AsteriskToken */:
130204
+ return containingNodeKind === 168 /* MethodDeclaration */; // const obj = { * c|
130205
+ }
130206
+ if (isClassMemberCompletionKeyword(tokenKind)) {
130207
+ return true;
130174
130208
  }
130175
130209
  }
130176
130210
  return false;
@@ -148475,11 +148509,11 @@ var ts;
148475
148509
  AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required";
148476
148510
  AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed";
148477
148511
  })(AddAsTypeOnly || (AddAsTypeOnly = {}));
148478
- function getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
148512
+ function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
148479
148513
  var compilerOptions = program.getCompilerOptions();
148480
148514
  var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name))
148481
- ? [getSymbolExportInfoForSymbol(exportedSymbol, moduleSymbol, program, host)]
148482
- : getAllReExportingModules(sourceFile, exportedSymbol, moduleSymbol, symbolName, host, program, preferences, /*useAutoImportProvider*/ true);
148515
+ ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)]
148516
+ : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, host, program, preferences, /*useAutoImportProvider*/ true);
148483
148517
  var useRequire = shouldUseRequire(sourceFile, program);
148484
148518
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position));
148485
148519
  var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
@@ -148517,7 +148551,7 @@ var ts;
148517
148551
  }
148518
148552
  }
148519
148553
  }
148520
- function getAllReExportingModules(importingFile, exportedSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
148554
+ function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
148521
148555
  var result = [];
148522
148556
  var compilerOptions = program.getCompilerOptions();
148523
148557
  var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) {
@@ -148530,12 +148564,12 @@ var ts;
148530
148564
  return;
148531
148565
  }
148532
148566
  var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
148533
- if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === exportedSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
148567
+ if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
148534
148568
  result.push({ symbol: defaultInfo.symbol, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: defaultInfo.exportKind, targetFlags: ts.skipAlias(defaultInfo.symbol, checker).flags, isFromPackageJson: isFromPackageJson });
148535
148569
  }
148536
148570
  for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) {
148537
148571
  var exported = _a[_i];
148538
- if (exported.name === symbolName && ts.skipAlias(exported, checker) === exportedSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
148572
+ if (exported.name === symbolName && checker.getMergedSymbol(ts.skipAlias(exported, checker)) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
148539
148573
  result.push({ symbol: exported, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: 0 /* Named */, targetFlags: ts.skipAlias(exported, checker).flags, isFromPackageJson: isFromPackageJson });
148540
148574
  }
148541
148575
  }
@@ -2747,7 +2747,6 @@ declare namespace ts {
2747
2747
  checkType: Type;
2748
2748
  extendsType: Type;
2749
2749
  isDistributive: boolean;
2750
- isDistributionDependent: boolean;
2751
2750
  inferTypeParameters?: TypeParameter[];
2752
2751
  outerTypeParameters?: TypeParameter[];
2753
2752
  instantiations?: Map<Type>;
package/lib/typescript.js CHANGED
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20211022";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20211026";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -8335,6 +8335,7 @@ var ts;
8335
8335
  Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1387, ts.DiagnosticCategory.Error, "Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387", "Function type notation must be parenthesized when used in an intersection type."),
8336
8336
  Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1388, ts.DiagnosticCategory.Error, "Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1388", "Constructor type notation must be parenthesized when used in an intersection type."),
8337
8337
  _0_is_not_allowed_as_a_variable_declaration_name: diag(1389, ts.DiagnosticCategory.Error, "_0_is_not_allowed_as_a_variable_declaration_name_1389", "'{0}' is not allowed as a variable declaration name."),
8338
+ _0_is_not_allowed_as_a_parameter_name: diag(1390, ts.DiagnosticCategory.Error, "_0_is_not_allowed_as_a_parameter_name_1390", "'{0}' is not allowed as a parameter name."),
8338
8339
  An_import_alias_cannot_use_import_type: diag(1392, ts.DiagnosticCategory.Error, "An_import_alias_cannot_use_import_type_1392", "An import alias cannot use 'import type'"),
8339
8340
  Imported_via_0_from_file_1: diag(1393, ts.DiagnosticCategory.Message, "Imported_via_0_from_file_1_1393", "Imported via {0} from file '{1}'"),
8340
8341
  Imported_via_0_from_file_1_with_packageId_2: diag(1394, ts.DiagnosticCategory.Message, "Imported_via_0_from_file_1_with_packageId_2_1394", "Imported via {0} from file '{1}' with packageId '{2}'"),
@@ -32127,7 +32128,10 @@ var ts;
32127
32128
  case 12 /* ObjectLiteralMembers */: return parseErrorAtCurrentToken(ts.Diagnostics.Property_assignment_expected);
32128
32129
  case 15 /* ArrayLiteralMembers */: return parseErrorAtCurrentToken(ts.Diagnostics.Expression_or_comma_expected);
32129
32130
  case 17 /* JSDocParameters */: return parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
32130
- case 16 /* Parameters */: return parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
32131
+ case 16 /* Parameters */:
32132
+ return ts.isKeyword(token())
32133
+ ? parseErrorAtCurrentToken(ts.Diagnostics._0_is_not_allowed_as_a_parameter_name, ts.tokenToString(token()))
32134
+ : parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
32131
32135
  case 19 /* TypeParameters */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_parameter_declaration_expected);
32132
32136
  case 20 /* TypeArguments */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_argument_expected);
32133
32137
  case 21 /* TupleElementTypes */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_expected);
@@ -45887,6 +45891,7 @@ var ts;
45887
45891
  case 168 /* MethodDeclaration */:
45888
45892
  case 171 /* GetAccessor */:
45889
45893
  case 172 /* SetAccessor */:
45894
+ case 169 /* ClassStaticBlockDeclaration */:
45890
45895
  // this.foo assignment in a JavaScript class
45891
45896
  // Bind this property to the containing class
45892
45897
  var containingClass = thisContainer.parent;
@@ -49597,21 +49602,28 @@ var ts;
49597
49602
  var namespaceName = getFullyQualifiedName(namespace);
49598
49603
  var declarationName = ts.declarationNameToString(right);
49599
49604
  var suggestionForNonexistentModule = getSuggestedSymbolForNonexistentModule(right, namespace);
49600
- var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
49601
- var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
49602
- var canSuggestTypeof = containingQualifiedName && !ts.isTypeOfExpression(containingQualifiedName.parent) && tryGetQualifiedNameAsValue(containingQualifiedName);
49603
49605
  if (suggestionForNonexistentModule) {
49604
49606
  error(right, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule));
49607
+ return undefined;
49605
49608
  }
49606
- else if (canSuggestTypeof) {
49609
+ var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
49610
+ var canSuggestTypeof = globalObjectType // <-- can't pull on types if global types aren't initialized yet
49611
+ && (meaning & 788968 /* Type */)
49612
+ && containingQualifiedName
49613
+ && !ts.isTypeOfExpression(containingQualifiedName.parent)
49614
+ && tryGetQualifiedNameAsValue(containingQualifiedName);
49615
+ if (canSuggestTypeof) {
49607
49616
  error(containingQualifiedName, ts.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, ts.entityNameToString(containingQualifiedName));
49617
+ return undefined;
49608
49618
  }
49609
- else if (meaning & 1920 /* Namespace */ && exportedTypeSymbol && ts.isQualifiedName(name.parent)) {
49610
- error(name.parent.right, ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, symbolToString(exportedTypeSymbol), ts.unescapeLeadingUnderscores(name.parent.right.escapedText));
49611
- }
49612
- else {
49613
- error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
49619
+ if (meaning & 1920 /* Namespace */ && ts.isQualifiedName(name.parent)) {
49620
+ var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
49621
+ if (exportedTypeSymbol) {
49622
+ error(name.parent.right, ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, symbolToString(exportedTypeSymbol), ts.unescapeLeadingUnderscores(name.parent.right.escapedText));
49623
+ return undefined;
49624
+ }
49614
49625
  }
49626
+ error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
49615
49627
  }
49616
49628
  return undefined;
49617
49629
  }
@@ -49947,8 +49959,8 @@ var ts;
49947
49959
  if (exportEquals !== moduleSymbol) {
49948
49960
  var type = getTypeOfSymbol(exportEquals);
49949
49961
  if (shouldTreatPropertiesOfExternalModuleAsExports(type)) {
49950
- getPropertiesOfType(type).forEach(function (symbol) {
49951
- cb(symbol, symbol.escapedName);
49962
+ forEachPropertyOfType(type, function (symbol, escapedName) {
49963
+ cb(symbol, escapedName);
49952
49964
  });
49953
49965
  }
49954
49966
  }
@@ -50280,12 +50292,15 @@ var ts;
50280
50292
  function getNamedMembers(members) {
50281
50293
  var result;
50282
50294
  members.forEach(function (symbol, id) {
50283
- if (!isReservedMemberName(id) && symbolIsValue(symbol)) {
50295
+ if (isNamedMember(symbol, id)) {
50284
50296
  (result || (result = [])).push(symbol);
50285
50297
  }
50286
50298
  });
50287
50299
  return result || ts.emptyArray;
50288
50300
  }
50301
+ function isNamedMember(member, escapedName) {
50302
+ return !isReservedMemberName(escapedName) && symbolIsValue(member);
50303
+ }
50289
50304
  function getNamedOrIndexSignatureMembers(members) {
50290
50305
  var result = getNamedMembers(members);
50291
50306
  var index = getIndexSymbolFromSymbolTable(members);
@@ -57118,6 +57133,16 @@ var ts;
57118
57133
  getPropertiesOfUnionOrIntersectionType(type) :
57119
57134
  getPropertiesOfObjectType(type);
57120
57135
  }
57136
+ function forEachPropertyOfType(type, action) {
57137
+ type = getReducedApparentType(type);
57138
+ if (type.flags & 3670016 /* StructuredType */) {
57139
+ resolveStructuredTypeMembers(type).members.forEach(function (symbol, escapedName) {
57140
+ if (isNamedMember(symbol, escapedName)) {
57141
+ action(symbol, escapedName);
57142
+ }
57143
+ });
57144
+ }
57145
+ }
57121
57146
  function isTypeInvalidDueToUnionDiscriminant(contextualType, obj) {
57122
57147
  var list = obj.properties;
57123
57148
  return list.some(function (property) {
@@ -60901,13 +60926,14 @@ var ts;
60901
60926
  }
60902
60927
  return result;
60903
60928
  }
60929
+ function isDistributionDependent(root) {
60930
+ return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
60931
+ isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
60932
+ }
60904
60933
  function getTypeFromConditionalTypeNode(node) {
60905
60934
  var links = getNodeLinks(node);
60906
60935
  if (!links.resolvedType) {
60907
60936
  var checkType = getTypeFromTypeNode(node.checkType);
60908
- var isDistributive = !!(checkType.flags & 262144 /* TypeParameter */);
60909
- var isDistributionDependent = isDistributive && (isTypeParameterPossiblyReferenced(checkType, node.trueType) ||
60910
- isTypeParameterPossiblyReferenced(checkType, node.falseType));
60911
60937
  var aliasSymbol = getAliasSymbolForTypeNode(node);
60912
60938
  var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
60913
60939
  var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
@@ -60916,8 +60942,7 @@ var ts;
60916
60942
  node: node,
60917
60943
  checkType: checkType,
60918
60944
  extendsType: getTypeFromTypeNode(node.extendsType),
60919
- isDistributive: isDistributive,
60920
- isDistributionDependent: isDistributionDependent,
60945
+ isDistributive: !!(checkType.flags & 262144 /* TypeParameter */),
60921
60946
  inferTypeParameters: getInferTypeParameters(node),
60922
60947
  outerTypeParameters: outerTypeParameters,
60923
60948
  instantiations: undefined,
@@ -64064,7 +64089,7 @@ var ts;
64064
64089
  // We check for a relationship to a conditional type target only when the conditional type has no
64065
64090
  // 'infer' positions and is not distributive or is distributive but doesn't reference the check type
64066
64091
  // parameter in either of the result types.
64067
- if (!c.root.inferTypeParameters && !c.root.isDistributionDependent) {
64092
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
64068
64093
  // Check if the conditional is always true or always false but still deferred for distribution purposes.
64069
64094
  var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
64070
64095
  var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
@@ -126146,10 +126171,14 @@ var ts;
126146
126171
  }
126147
126172
  var isDefault = exportKind === 1 /* Default */;
126148
126173
  var namedSymbol = isDefault && ts.getLocalSymbolForExportDefault(symbol) || symbol;
126149
- // A re-export merged with an export from a module augmentation can result in `symbol`
126150
- // being an external module symbol; the name it is re-exported by will be `symbolTableKey`
126151
- // (which comes from the keys of `moduleSymbol.exports`.)
126152
- var importedName = ts.isExternalModuleSymbol(namedSymbol)
126174
+ // 1. A named export must be imported by its key in `moduleSymbol.exports` or `moduleSymbol.members`.
126175
+ // 2. A re-export merged with an export from a module augmentation can result in `symbol`
126176
+ // being an external module symbol; the name it is re-exported by will be `symbolTableKey`
126177
+ // (which comes from the keys of `moduleSymbol.exports`.)
126178
+ // 3. Otherwise, we have a default/namespace import that can be imported by any name, and
126179
+ // `symbolTableKey` will be something undesirable like `export=` or `default`, so we try to
126180
+ // get a better name.
126181
+ var importedName = exportKind === 0 /* Named */ || ts.isExternalModuleSymbol(namedSymbol)
126153
126182
  ? ts.unescapeLeadingUnderscores(symbolTableKey)
126154
126183
  : ts.getNameForExportedSymbol(namedSymbol, scriptTarget);
126155
126184
  var moduleName = ts.stripQuotes(moduleSymbol.name);
@@ -126380,7 +126409,7 @@ var ts;
126380
126409
  cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, scriptTarget, checker);
126381
126410
  }
126382
126411
  checker.forEachExportAndPropertyOfModule(moduleSymbol, function (exported, key) {
126383
- if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, exported)) {
126412
+ if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
126384
126413
  cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, scriptTarget, checker);
126385
126414
  }
126386
126415
  });
@@ -129235,8 +129264,8 @@ var ts;
129235
129264
  }
129236
129265
  var checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker();
129237
129266
  var moduleSymbol = origin.moduleSymbol;
129238
- var exportedSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
129239
- var _b = ts.codefix.getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions)), host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _b.moduleSpecifier, codeAction = _b.codeAction;
129267
+ var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
129268
+ var _b = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions)), host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _b.moduleSpecifier, codeAction = _b.codeAction;
129240
129269
  ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier);
129241
129270
  return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] };
129242
129271
  }
@@ -130131,8 +130160,9 @@ var ts;
130131
130160
  function isNewIdentifierDefinitionLocation() {
130132
130161
  if (contextToken) {
130133
130162
  var containingNodeKind = contextToken.parent.kind;
130163
+ var tokenKind = keywordForNode(contextToken);
130134
130164
  // Previous token may have been a keyword that was converted to an identifier.
130135
- switch (keywordForNode(contextToken)) {
130165
+ switch (tokenKind) {
130136
130166
  case 27 /* CommaToken */:
130137
130167
  return containingNodeKind === 207 /* CallExpression */ // func( a, |
130138
130168
  || containingNodeKind === 170 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
@@ -130167,10 +130197,14 @@ var ts;
130167
130197
  return containingNodeKind === 222 /* TemplateExpression */; // `aa ${|
130168
130198
  case 16 /* TemplateMiddle */:
130169
130199
  return containingNodeKind === 232 /* TemplateSpan */; // `aa ${10} dd ${|
130170
- case 123 /* PublicKeyword */:
130171
- case 121 /* PrivateKeyword */:
130172
- case 122 /* ProtectedKeyword */:
130173
- return containingNodeKind === 166 /* PropertyDeclaration */; // class A{ public |
130200
+ case 131 /* AsyncKeyword */:
130201
+ return containingNodeKind === 168 /* MethodDeclaration */ // const obj = { async c|()
130202
+ || containingNodeKind === 295 /* ShorthandPropertyAssignment */; // const obj = { async c|
130203
+ case 41 /* AsteriskToken */:
130204
+ return containingNodeKind === 168 /* MethodDeclaration */; // const obj = { * c|
130205
+ }
130206
+ if (isClassMemberCompletionKeyword(tokenKind)) {
130207
+ return true;
130174
130208
  }
130175
130209
  }
130176
130210
  return false;
@@ -148475,11 +148509,11 @@ var ts;
148475
148509
  AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required";
148476
148510
  AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed";
148477
148511
  })(AddAsTypeOnly || (AddAsTypeOnly = {}));
148478
- function getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
148512
+ function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
148479
148513
  var compilerOptions = program.getCompilerOptions();
148480
148514
  var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name))
148481
- ? [getSymbolExportInfoForSymbol(exportedSymbol, moduleSymbol, program, host)]
148482
- : getAllReExportingModules(sourceFile, exportedSymbol, moduleSymbol, symbolName, host, program, preferences, /*useAutoImportProvider*/ true);
148515
+ ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)]
148516
+ : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, host, program, preferences, /*useAutoImportProvider*/ true);
148483
148517
  var useRequire = shouldUseRequire(sourceFile, program);
148484
148518
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position));
148485
148519
  var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
@@ -148517,7 +148551,7 @@ var ts;
148517
148551
  }
148518
148552
  }
148519
148553
  }
148520
- function getAllReExportingModules(importingFile, exportedSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
148554
+ function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
148521
148555
  var result = [];
148522
148556
  var compilerOptions = program.getCompilerOptions();
148523
148557
  var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) {
@@ -148530,12 +148564,12 @@ var ts;
148530
148564
  return;
148531
148565
  }
148532
148566
  var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
148533
- if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === exportedSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
148567
+ if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
148534
148568
  result.push({ symbol: defaultInfo.symbol, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: defaultInfo.exportKind, targetFlags: ts.skipAlias(defaultInfo.symbol, checker).flags, isFromPackageJson: isFromPackageJson });
148535
148569
  }
148536
148570
  for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) {
148537
148571
  var exported = _a[_i];
148538
- if (exported.name === symbolName && ts.skipAlias(exported, checker) === exportedSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
148572
+ if (exported.name === symbolName && checker.getMergedSymbol(ts.skipAlias(exported, checker)) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
148539
148573
  result.push({ symbol: exported, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: 0 /* Named */, targetFlags: ts.skipAlias(exported, checker).flags, isFromPackageJson: isFromPackageJson });
148540
148574
  }
148541
148575
  }
@@ -2747,7 +2747,6 @@ declare namespace ts {
2747
2747
  checkType: Type;
2748
2748
  extendsType: Type;
2749
2749
  isDistributive: boolean;
2750
- isDistributionDependent: boolean;
2751
2750
  inferTypeParameters?: TypeParameter[];
2752
2751
  outerTypeParameters?: TypeParameter[];
2753
2752
  instantiations?: Map<Type>;