typescript 4.5.0-dev.20211022 → 4.5.0-dev.20211023

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.
package/lib/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.5";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20211022";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20211023";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  function tryGetNativeMap() {
@@ -5363,6 +5363,7 @@ var ts;
5363
5363
  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."),
5364
5364
  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."),
5365
5365
  _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."),
5366
+ _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."),
5366
5367
  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'"),
5367
5368
  Imported_via_0_from_file_1: diag(1393, ts.DiagnosticCategory.Message, "Imported_via_0_from_file_1_1393", "Imported via {0} from file '{1}'"),
5368
5369
  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}'"),
@@ -25737,7 +25738,10 @@ var ts;
25737
25738
  case 12: return parseErrorAtCurrentToken(ts.Diagnostics.Property_assignment_expected);
25738
25739
  case 15: return parseErrorAtCurrentToken(ts.Diagnostics.Expression_or_comma_expected);
25739
25740
  case 17: return parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
25740
- case 16: return parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
25741
+ case 16:
25742
+ return ts.isKeyword(token())
25743
+ ? parseErrorAtCurrentToken(ts.Diagnostics._0_is_not_allowed_as_a_parameter_name, ts.tokenToString(token()))
25744
+ : parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
25741
25745
  case 19: return parseErrorAtCurrentToken(ts.Diagnostics.Type_parameter_declaration_expected);
25742
25746
  case 20: return parseErrorAtCurrentToken(ts.Diagnostics.Type_argument_expected);
25743
25747
  case 21: return parseErrorAtCurrentToken(ts.Diagnostics.Type_expected);
@@ -37474,6 +37478,7 @@ var ts;
37474
37478
  case 168:
37475
37479
  case 171:
37476
37480
  case 172:
37481
+ case 169:
37477
37482
  var containingClass = thisContainer.parent;
37478
37483
  var symbolTable = ts.isStatic(thisContainer) ? containingClass.symbol.exports : containingClass.symbol.members;
37479
37484
  if (ts.hasDynamicName(node)) {
@@ -40868,8 +40873,8 @@ var ts;
40868
40873
  if (exportEquals !== moduleSymbol) {
40869
40874
  var type = getTypeOfSymbol(exportEquals);
40870
40875
  if (shouldTreatPropertiesOfExternalModuleAsExports(type)) {
40871
- getPropertiesOfType(type).forEach(function (symbol) {
40872
- cb(symbol, symbol.escapedName);
40876
+ forEachPropertyOfType(type, function (symbol, escapedName) {
40877
+ cb(symbol, escapedName);
40873
40878
  });
40874
40879
  }
40875
40880
  }
@@ -41169,12 +41174,15 @@ var ts;
41169
41174
  function getNamedMembers(members) {
41170
41175
  var result;
41171
41176
  members.forEach(function (symbol, id) {
41172
- if (!isReservedMemberName(id) && symbolIsValue(symbol)) {
41177
+ if (isNamedMember(symbol, id)) {
41173
41178
  (result || (result = [])).push(symbol);
41174
41179
  }
41175
41180
  });
41176
41181
  return result || ts.emptyArray;
41177
41182
  }
41183
+ function isNamedMember(member, escapedName) {
41184
+ return !isReservedMemberName(escapedName) && symbolIsValue(member);
41185
+ }
41178
41186
  function getNamedOrIndexSignatureMembers(members) {
41179
41187
  var result = getNamedMembers(members);
41180
41188
  var index = getIndexSymbolFromSymbolTable(members);
@@ -47090,6 +47098,16 @@ var ts;
47090
47098
  getPropertiesOfUnionOrIntersectionType(type) :
47091
47099
  getPropertiesOfObjectType(type);
47092
47100
  }
47101
+ function forEachPropertyOfType(type, action) {
47102
+ type = getReducedApparentType(type);
47103
+ if (type.flags & 3670016) {
47104
+ resolveStructuredTypeMembers(type).members.forEach(function (symbol, escapedName) {
47105
+ if (isNamedMember(symbol, escapedName)) {
47106
+ action(symbol, escapedName);
47107
+ }
47108
+ });
47109
+ }
47110
+ }
47093
47111
  function isTypeInvalidDueToUnionDiscriminant(contextualType, obj) {
47094
47112
  var list = obj.properties;
47095
47113
  return list.some(function (property) {
@@ -50421,13 +50439,14 @@ var ts;
50421
50439
  }
50422
50440
  return result;
50423
50441
  }
50442
+ function isDistributionDependent(root) {
50443
+ return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
50444
+ isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
50445
+ }
50424
50446
  function getTypeFromConditionalTypeNode(node) {
50425
50447
  var links = getNodeLinks(node);
50426
50448
  if (!links.resolvedType) {
50427
50449
  var checkType = getTypeFromTypeNode(node.checkType);
50428
- var isDistributive = !!(checkType.flags & 262144);
50429
- var isDistributionDependent = isDistributive && (isTypeParameterPossiblyReferenced(checkType, node.trueType) ||
50430
- isTypeParameterPossiblyReferenced(checkType, node.falseType));
50431
50450
  var aliasSymbol = getAliasSymbolForTypeNode(node);
50432
50451
  var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
50433
50452
  var allOuterTypeParameters = getOuterTypeParameters(node, true);
@@ -50436,8 +50455,7 @@ var ts;
50436
50455
  node: node,
50437
50456
  checkType: checkType,
50438
50457
  extendsType: getTypeFromTypeNode(node.extendsType),
50439
- isDistributive: isDistributive,
50440
- isDistributionDependent: isDistributionDependent,
50458
+ isDistributive: !!(checkType.flags & 262144),
50441
50459
  inferTypeParameters: getInferTypeParameters(node),
50442
50460
  outerTypeParameters: outerTypeParameters,
50443
50461
  instantiations: undefined,
@@ -53194,7 +53212,7 @@ var ts;
53194
53212
  return 3;
53195
53213
  }
53196
53214
  var c = target;
53197
- if (!c.root.inferTypeParameters && !c.root.isDistributionDependent) {
53215
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
53198
53216
  var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
53199
53217
  var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
53200
53218
  if (result = skipTrue ? -1 : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2, false)) {
package/lib/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-dev.20211022";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20211023";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -8141,6 +8141,7 @@ var ts;
8141
8141
  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."),
8142
8142
  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."),
8143
8143
  _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."),
8144
+ _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."),
8144
8145
  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'"),
8145
8146
  Imported_via_0_from_file_1: diag(1393, ts.DiagnosticCategory.Message, "Imported_via_0_from_file_1_1393", "Imported via {0} from file '{1}'"),
8146
8147
  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}'"),
@@ -31933,7 +31934,10 @@ var ts;
31933
31934
  case 12 /* ObjectLiteralMembers */: return parseErrorAtCurrentToken(ts.Diagnostics.Property_assignment_expected);
31934
31935
  case 15 /* ArrayLiteralMembers */: return parseErrorAtCurrentToken(ts.Diagnostics.Expression_or_comma_expected);
31935
31936
  case 17 /* JSDocParameters */: return parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
31936
- case 16 /* Parameters */: return parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
31937
+ case 16 /* Parameters */:
31938
+ return ts.isKeyword(token())
31939
+ ? parseErrorAtCurrentToken(ts.Diagnostics._0_is_not_allowed_as_a_parameter_name, ts.tokenToString(token()))
31940
+ : parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
31937
31941
  case 19 /* TypeParameters */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_parameter_declaration_expected);
31938
31942
  case 20 /* TypeArguments */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_argument_expected);
31939
31943
  case 21 /* TupleElementTypes */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_expected);
@@ -45693,6 +45697,7 @@ var ts;
45693
45697
  case 168 /* MethodDeclaration */:
45694
45698
  case 171 /* GetAccessor */:
45695
45699
  case 172 /* SetAccessor */:
45700
+ case 169 /* ClassStaticBlockDeclaration */:
45696
45701
  // this.foo assignment in a JavaScript class
45697
45702
  // Bind this property to the containing class
45698
45703
  var containingClass = thisContainer.parent;
@@ -49753,8 +49758,8 @@ var ts;
49753
49758
  if (exportEquals !== moduleSymbol) {
49754
49759
  var type = getTypeOfSymbol(exportEquals);
49755
49760
  if (shouldTreatPropertiesOfExternalModuleAsExports(type)) {
49756
- getPropertiesOfType(type).forEach(function (symbol) {
49757
- cb(symbol, symbol.escapedName);
49761
+ forEachPropertyOfType(type, function (symbol, escapedName) {
49762
+ cb(symbol, escapedName);
49758
49763
  });
49759
49764
  }
49760
49765
  }
@@ -50086,12 +50091,15 @@ var ts;
50086
50091
  function getNamedMembers(members) {
50087
50092
  var result;
50088
50093
  members.forEach(function (symbol, id) {
50089
- if (!isReservedMemberName(id) && symbolIsValue(symbol)) {
50094
+ if (isNamedMember(symbol, id)) {
50090
50095
  (result || (result = [])).push(symbol);
50091
50096
  }
50092
50097
  });
50093
50098
  return result || ts.emptyArray;
50094
50099
  }
50100
+ function isNamedMember(member, escapedName) {
50101
+ return !isReservedMemberName(escapedName) && symbolIsValue(member);
50102
+ }
50095
50103
  function getNamedOrIndexSignatureMembers(members) {
50096
50104
  var result = getNamedMembers(members);
50097
50105
  var index = getIndexSymbolFromSymbolTable(members);
@@ -56924,6 +56932,16 @@ var ts;
56924
56932
  getPropertiesOfUnionOrIntersectionType(type) :
56925
56933
  getPropertiesOfObjectType(type);
56926
56934
  }
56935
+ function forEachPropertyOfType(type, action) {
56936
+ type = getReducedApparentType(type);
56937
+ if (type.flags & 3670016 /* StructuredType */) {
56938
+ resolveStructuredTypeMembers(type).members.forEach(function (symbol, escapedName) {
56939
+ if (isNamedMember(symbol, escapedName)) {
56940
+ action(symbol, escapedName);
56941
+ }
56942
+ });
56943
+ }
56944
+ }
56927
56945
  function isTypeInvalidDueToUnionDiscriminant(contextualType, obj) {
56928
56946
  var list = obj.properties;
56929
56947
  return list.some(function (property) {
@@ -60707,13 +60725,14 @@ var ts;
60707
60725
  }
60708
60726
  return result;
60709
60727
  }
60728
+ function isDistributionDependent(root) {
60729
+ return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
60730
+ isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
60731
+ }
60710
60732
  function getTypeFromConditionalTypeNode(node) {
60711
60733
  var links = getNodeLinks(node);
60712
60734
  if (!links.resolvedType) {
60713
60735
  var checkType = getTypeFromTypeNode(node.checkType);
60714
- var isDistributive = !!(checkType.flags & 262144 /* TypeParameter */);
60715
- var isDistributionDependent = isDistributive && (isTypeParameterPossiblyReferenced(checkType, node.trueType) ||
60716
- isTypeParameterPossiblyReferenced(checkType, node.falseType));
60717
60736
  var aliasSymbol = getAliasSymbolForTypeNode(node);
60718
60737
  var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
60719
60738
  var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
@@ -60722,8 +60741,7 @@ var ts;
60722
60741
  node: node,
60723
60742
  checkType: checkType,
60724
60743
  extendsType: getTypeFromTypeNode(node.extendsType),
60725
- isDistributive: isDistributive,
60726
- isDistributionDependent: isDistributionDependent,
60744
+ isDistributive: !!(checkType.flags & 262144 /* TypeParameter */),
60727
60745
  inferTypeParameters: getInferTypeParameters(node),
60728
60746
  outerTypeParameters: outerTypeParameters,
60729
60747
  instantiations: undefined,
@@ -63870,7 +63888,7 @@ var ts;
63870
63888
  // We check for a relationship to a conditional type target only when the conditional type has no
63871
63889
  // 'infer' positions and is not distributive or is distributive but doesn't reference the check type
63872
63890
  // parameter in either of the result types.
63873
- if (!c.root.inferTypeParameters && !c.root.isDistributionDependent) {
63891
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
63874
63892
  // Check if the conditional is always true or always false but still deferred for distribution purposes.
63875
63893
  var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
63876
63894
  var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
@@ -125564,10 +125582,14 @@ var ts;
125564
125582
  }
125565
125583
  var isDefault = exportKind === 1 /* Default */;
125566
125584
  var namedSymbol = isDefault && ts.getLocalSymbolForExportDefault(symbol) || symbol;
125567
- // A re-export merged with an export from a module augmentation can result in `symbol`
125568
- // being an external module symbol; the name it is re-exported by will be `symbolTableKey`
125569
- // (which comes from the keys of `moduleSymbol.exports`.)
125570
- var importedName = ts.isExternalModuleSymbol(namedSymbol)
125585
+ // 1. A named export must be imported by its key in `moduleSymbol.exports` or `moduleSymbol.members`.
125586
+ // 2. A re-export merged with an export from a module augmentation can result in `symbol`
125587
+ // being an external module symbol; the name it is re-exported by will be `symbolTableKey`
125588
+ // (which comes from the keys of `moduleSymbol.exports`.)
125589
+ // 3. Otherwise, we have a default/namespace import that can be imported by any name, and
125590
+ // `symbolTableKey` will be something undesirable like `export=` or `default`, so we try to
125591
+ // get a better name.
125592
+ var importedName = exportKind === 0 /* Named */ || ts.isExternalModuleSymbol(namedSymbol)
125571
125593
  ? ts.unescapeLeadingUnderscores(symbolTableKey)
125572
125594
  : ts.getNameForExportedSymbol(namedSymbol, scriptTarget);
125573
125595
  var moduleName = ts.stripQuotes(moduleSymbol.name);
@@ -125798,7 +125820,7 @@ var ts;
125798
125820
  cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, scriptTarget, checker);
125799
125821
  }
125800
125822
  checker.forEachExportAndPropertyOfModule(moduleSymbol, function (exported, key) {
125801
- if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, exported)) {
125823
+ if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
125802
125824
  cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, scriptTarget, checker);
125803
125825
  }
125804
125826
  });
@@ -128653,8 +128675,8 @@ var ts;
128653
128675
  }
128654
128676
  var checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker();
128655
128677
  var moduleSymbol = origin.moduleSymbol;
128656
- var exportedSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
128657
- 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;
128678
+ var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
128679
+ 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;
128658
128680
  ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier);
128659
128681
  return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] };
128660
128682
  }
@@ -129549,8 +129571,9 @@ var ts;
129549
129571
  function isNewIdentifierDefinitionLocation() {
129550
129572
  if (contextToken) {
129551
129573
  var containingNodeKind = contextToken.parent.kind;
129574
+ var tokenKind = keywordForNode(contextToken);
129552
129575
  // Previous token may have been a keyword that was converted to an identifier.
129553
- switch (keywordForNode(contextToken)) {
129576
+ switch (tokenKind) {
129554
129577
  case 27 /* CommaToken */:
129555
129578
  return containingNodeKind === 207 /* CallExpression */ // func( a, |
129556
129579
  || containingNodeKind === 170 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
@@ -129585,10 +129608,12 @@ var ts;
129585
129608
  return containingNodeKind === 222 /* TemplateExpression */; // `aa ${|
129586
129609
  case 16 /* TemplateMiddle */:
129587
129610
  return containingNodeKind === 232 /* TemplateSpan */; // `aa ${10} dd ${|
129588
- case 123 /* PublicKeyword */:
129589
- case 121 /* PrivateKeyword */:
129590
- case 122 /* ProtectedKeyword */:
129591
- return containingNodeKind === 166 /* PropertyDeclaration */; // class A{ public |
129611
+ case 131 /* AsyncKeyword */:
129612
+ return containingNodeKind === 168 /* MethodDeclaration */ // const obj = { async c|()
129613
+ || containingNodeKind === 295 /* ShorthandPropertyAssignment */; // const obj = { async c|
129614
+ }
129615
+ if (isClassMemberCompletionKeyword(tokenKind)) {
129616
+ return true;
129592
129617
  }
129593
129618
  }
129594
129619
  return false;
@@ -147893,11 +147918,11 @@ var ts;
147893
147918
  AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required";
147894
147919
  AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed";
147895
147920
  })(AddAsTypeOnly || (AddAsTypeOnly = {}));
147896
- function getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
147921
+ function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
147897
147922
  var compilerOptions = program.getCompilerOptions();
147898
147923
  var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name))
147899
- ? [getSymbolExportInfoForSymbol(exportedSymbol, moduleSymbol, program, host)]
147900
- : getAllReExportingModules(sourceFile, exportedSymbol, moduleSymbol, symbolName, host, program, preferences, /*useAutoImportProvider*/ true);
147924
+ ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)]
147925
+ : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, host, program, preferences, /*useAutoImportProvider*/ true);
147901
147926
  var useRequire = shouldUseRequire(sourceFile, program);
147902
147927
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position));
147903
147928
  var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
@@ -147935,7 +147960,7 @@ var ts;
147935
147960
  }
147936
147961
  }
147937
147962
  }
147938
- function getAllReExportingModules(importingFile, exportedSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
147963
+ function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
147939
147964
  var result = [];
147940
147965
  var compilerOptions = program.getCompilerOptions();
147941
147966
  var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) {
@@ -147948,12 +147973,12 @@ var ts;
147948
147973
  return;
147949
147974
  }
147950
147975
  var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
147951
- if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === exportedSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
147976
+ if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
147952
147977
  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 });
147953
147978
  }
147954
147979
  for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) {
147955
147980
  var exported = _a[_i];
147956
- if (exported.name === symbolName && ts.skipAlias(exported, checker) === exportedSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
147981
+ if (exported.name === symbolName && checker.getMergedSymbol(ts.skipAlias(exported, checker)) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
147957
147982
  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 });
147958
147983
  }
147959
147984
  }
@@ -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>;
@@ -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.20211023";
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;
@@ -49947,8 +49952,8 @@ var ts;
49947
49952
  if (exportEquals !== moduleSymbol) {
49948
49953
  var type = getTypeOfSymbol(exportEquals);
49949
49954
  if (shouldTreatPropertiesOfExternalModuleAsExports(type)) {
49950
- getPropertiesOfType(type).forEach(function (symbol) {
49951
- cb(symbol, symbol.escapedName);
49955
+ forEachPropertyOfType(type, function (symbol, escapedName) {
49956
+ cb(symbol, escapedName);
49952
49957
  });
49953
49958
  }
49954
49959
  }
@@ -50280,12 +50285,15 @@ var ts;
50280
50285
  function getNamedMembers(members) {
50281
50286
  var result;
50282
50287
  members.forEach(function (symbol, id) {
50283
- if (!isReservedMemberName(id) && symbolIsValue(symbol)) {
50288
+ if (isNamedMember(symbol, id)) {
50284
50289
  (result || (result = [])).push(symbol);
50285
50290
  }
50286
50291
  });
50287
50292
  return result || ts.emptyArray;
50288
50293
  }
50294
+ function isNamedMember(member, escapedName) {
50295
+ return !isReservedMemberName(escapedName) && symbolIsValue(member);
50296
+ }
50289
50297
  function getNamedOrIndexSignatureMembers(members) {
50290
50298
  var result = getNamedMembers(members);
50291
50299
  var index = getIndexSymbolFromSymbolTable(members);
@@ -57118,6 +57126,16 @@ var ts;
57118
57126
  getPropertiesOfUnionOrIntersectionType(type) :
57119
57127
  getPropertiesOfObjectType(type);
57120
57128
  }
57129
+ function forEachPropertyOfType(type, action) {
57130
+ type = getReducedApparentType(type);
57131
+ if (type.flags & 3670016 /* StructuredType */) {
57132
+ resolveStructuredTypeMembers(type).members.forEach(function (symbol, escapedName) {
57133
+ if (isNamedMember(symbol, escapedName)) {
57134
+ action(symbol, escapedName);
57135
+ }
57136
+ });
57137
+ }
57138
+ }
57121
57139
  function isTypeInvalidDueToUnionDiscriminant(contextualType, obj) {
57122
57140
  var list = obj.properties;
57123
57141
  return list.some(function (property) {
@@ -60901,13 +60919,14 @@ var ts;
60901
60919
  }
60902
60920
  return result;
60903
60921
  }
60922
+ function isDistributionDependent(root) {
60923
+ return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
60924
+ isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
60925
+ }
60904
60926
  function getTypeFromConditionalTypeNode(node) {
60905
60927
  var links = getNodeLinks(node);
60906
60928
  if (!links.resolvedType) {
60907
60929
  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
60930
  var aliasSymbol = getAliasSymbolForTypeNode(node);
60912
60931
  var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
60913
60932
  var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
@@ -60916,8 +60935,7 @@ var ts;
60916
60935
  node: node,
60917
60936
  checkType: checkType,
60918
60937
  extendsType: getTypeFromTypeNode(node.extendsType),
60919
- isDistributive: isDistributive,
60920
- isDistributionDependent: isDistributionDependent,
60938
+ isDistributive: !!(checkType.flags & 262144 /* TypeParameter */),
60921
60939
  inferTypeParameters: getInferTypeParameters(node),
60922
60940
  outerTypeParameters: outerTypeParameters,
60923
60941
  instantiations: undefined,
@@ -64064,7 +64082,7 @@ var ts;
64064
64082
  // We check for a relationship to a conditional type target only when the conditional type has no
64065
64083
  // 'infer' positions and is not distributive or is distributive but doesn't reference the check type
64066
64084
  // parameter in either of the result types.
64067
- if (!c.root.inferTypeParameters && !c.root.isDistributionDependent) {
64085
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
64068
64086
  // Check if the conditional is always true or always false but still deferred for distribution purposes.
64069
64087
  var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
64070
64088
  var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
@@ -126146,10 +126164,14 @@ var ts;
126146
126164
  }
126147
126165
  var isDefault = exportKind === 1 /* Default */;
126148
126166
  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)
126167
+ // 1. A named export must be imported by its key in `moduleSymbol.exports` or `moduleSymbol.members`.
126168
+ // 2. A re-export merged with an export from a module augmentation can result in `symbol`
126169
+ // being an external module symbol; the name it is re-exported by will be `symbolTableKey`
126170
+ // (which comes from the keys of `moduleSymbol.exports`.)
126171
+ // 3. Otherwise, we have a default/namespace import that can be imported by any name, and
126172
+ // `symbolTableKey` will be something undesirable like `export=` or `default`, so we try to
126173
+ // get a better name.
126174
+ var importedName = exportKind === 0 /* Named */ || ts.isExternalModuleSymbol(namedSymbol)
126153
126175
  ? ts.unescapeLeadingUnderscores(symbolTableKey)
126154
126176
  : ts.getNameForExportedSymbol(namedSymbol, scriptTarget);
126155
126177
  var moduleName = ts.stripQuotes(moduleSymbol.name);
@@ -126380,7 +126402,7 @@ var ts;
126380
126402
  cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, scriptTarget, checker);
126381
126403
  }
126382
126404
  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)) {
126405
+ if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
126384
126406
  cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, scriptTarget, checker);
126385
126407
  }
126386
126408
  });
@@ -129235,8 +129257,8 @@ var ts;
129235
129257
  }
129236
129258
  var checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker();
129237
129259
  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;
129260
+ var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
129261
+ 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
129262
  ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier);
129241
129263
  return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] };
129242
129264
  }
@@ -130131,8 +130153,9 @@ var ts;
130131
130153
  function isNewIdentifierDefinitionLocation() {
130132
130154
  if (contextToken) {
130133
130155
  var containingNodeKind = contextToken.parent.kind;
130156
+ var tokenKind = keywordForNode(contextToken);
130134
130157
  // Previous token may have been a keyword that was converted to an identifier.
130135
- switch (keywordForNode(contextToken)) {
130158
+ switch (tokenKind) {
130136
130159
  case 27 /* CommaToken */:
130137
130160
  return containingNodeKind === 207 /* CallExpression */ // func( a, |
130138
130161
  || containingNodeKind === 170 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
@@ -130167,10 +130190,12 @@ var ts;
130167
130190
  return containingNodeKind === 222 /* TemplateExpression */; // `aa ${|
130168
130191
  case 16 /* TemplateMiddle */:
130169
130192
  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 |
130193
+ case 131 /* AsyncKeyword */:
130194
+ return containingNodeKind === 168 /* MethodDeclaration */ // const obj = { async c|()
130195
+ || containingNodeKind === 295 /* ShorthandPropertyAssignment */; // const obj = { async c|
130196
+ }
130197
+ if (isClassMemberCompletionKeyword(tokenKind)) {
130198
+ return true;
130174
130199
  }
130175
130200
  }
130176
130201
  return false;
@@ -148475,11 +148500,11 @@ var ts;
148475
148500
  AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required";
148476
148501
  AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed";
148477
148502
  })(AddAsTypeOnly || (AddAsTypeOnly = {}));
148478
- function getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
148503
+ function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
148479
148504
  var compilerOptions = program.getCompilerOptions();
148480
148505
  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);
148506
+ ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)]
148507
+ : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, host, program, preferences, /*useAutoImportProvider*/ true);
148483
148508
  var useRequire = shouldUseRequire(sourceFile, program);
148484
148509
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position));
148485
148510
  var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
@@ -148517,7 +148542,7 @@ var ts;
148517
148542
  }
148518
148543
  }
148519
148544
  }
148520
- function getAllReExportingModules(importingFile, exportedSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
148545
+ function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
148521
148546
  var result = [];
148522
148547
  var compilerOptions = program.getCompilerOptions();
148523
148548
  var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) {
@@ -148530,12 +148555,12 @@ var ts;
148530
148555
  return;
148531
148556
  }
148532
148557
  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)) {
148558
+ if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
148534
148559
  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
148560
  }
148536
148561
  for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) {
148537
148562
  var exported = _a[_i];
148538
- if (exported.name === symbolName && ts.skipAlias(exported, checker) === exportedSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
148563
+ if (exported.name === symbolName && checker.getMergedSymbol(ts.skipAlias(exported, checker)) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
148539
148564
  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
148565
  }
148541
148566
  }
@@ -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.20211023";
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;
@@ -49947,8 +49952,8 @@ var ts;
49947
49952
  if (exportEquals !== moduleSymbol) {
49948
49953
  var type = getTypeOfSymbol(exportEquals);
49949
49954
  if (shouldTreatPropertiesOfExternalModuleAsExports(type)) {
49950
- getPropertiesOfType(type).forEach(function (symbol) {
49951
- cb(symbol, symbol.escapedName);
49955
+ forEachPropertyOfType(type, function (symbol, escapedName) {
49956
+ cb(symbol, escapedName);
49952
49957
  });
49953
49958
  }
49954
49959
  }
@@ -50280,12 +50285,15 @@ var ts;
50280
50285
  function getNamedMembers(members) {
50281
50286
  var result;
50282
50287
  members.forEach(function (symbol, id) {
50283
- if (!isReservedMemberName(id) && symbolIsValue(symbol)) {
50288
+ if (isNamedMember(symbol, id)) {
50284
50289
  (result || (result = [])).push(symbol);
50285
50290
  }
50286
50291
  });
50287
50292
  return result || ts.emptyArray;
50288
50293
  }
50294
+ function isNamedMember(member, escapedName) {
50295
+ return !isReservedMemberName(escapedName) && symbolIsValue(member);
50296
+ }
50289
50297
  function getNamedOrIndexSignatureMembers(members) {
50290
50298
  var result = getNamedMembers(members);
50291
50299
  var index = getIndexSymbolFromSymbolTable(members);
@@ -57118,6 +57126,16 @@ var ts;
57118
57126
  getPropertiesOfUnionOrIntersectionType(type) :
57119
57127
  getPropertiesOfObjectType(type);
57120
57128
  }
57129
+ function forEachPropertyOfType(type, action) {
57130
+ type = getReducedApparentType(type);
57131
+ if (type.flags & 3670016 /* StructuredType */) {
57132
+ resolveStructuredTypeMembers(type).members.forEach(function (symbol, escapedName) {
57133
+ if (isNamedMember(symbol, escapedName)) {
57134
+ action(symbol, escapedName);
57135
+ }
57136
+ });
57137
+ }
57138
+ }
57121
57139
  function isTypeInvalidDueToUnionDiscriminant(contextualType, obj) {
57122
57140
  var list = obj.properties;
57123
57141
  return list.some(function (property) {
@@ -60901,13 +60919,14 @@ var ts;
60901
60919
  }
60902
60920
  return result;
60903
60921
  }
60922
+ function isDistributionDependent(root) {
60923
+ return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
60924
+ isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
60925
+ }
60904
60926
  function getTypeFromConditionalTypeNode(node) {
60905
60927
  var links = getNodeLinks(node);
60906
60928
  if (!links.resolvedType) {
60907
60929
  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
60930
  var aliasSymbol = getAliasSymbolForTypeNode(node);
60912
60931
  var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
60913
60932
  var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
@@ -60916,8 +60935,7 @@ var ts;
60916
60935
  node: node,
60917
60936
  checkType: checkType,
60918
60937
  extendsType: getTypeFromTypeNode(node.extendsType),
60919
- isDistributive: isDistributive,
60920
- isDistributionDependent: isDistributionDependent,
60938
+ isDistributive: !!(checkType.flags & 262144 /* TypeParameter */),
60921
60939
  inferTypeParameters: getInferTypeParameters(node),
60922
60940
  outerTypeParameters: outerTypeParameters,
60923
60941
  instantiations: undefined,
@@ -64064,7 +64082,7 @@ var ts;
64064
64082
  // We check for a relationship to a conditional type target only when the conditional type has no
64065
64083
  // 'infer' positions and is not distributive or is distributive but doesn't reference the check type
64066
64084
  // parameter in either of the result types.
64067
- if (!c.root.inferTypeParameters && !c.root.isDistributionDependent) {
64085
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
64068
64086
  // Check if the conditional is always true or always false but still deferred for distribution purposes.
64069
64087
  var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
64070
64088
  var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
@@ -126146,10 +126164,14 @@ var ts;
126146
126164
  }
126147
126165
  var isDefault = exportKind === 1 /* Default */;
126148
126166
  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)
126167
+ // 1. A named export must be imported by its key in `moduleSymbol.exports` or `moduleSymbol.members`.
126168
+ // 2. A re-export merged with an export from a module augmentation can result in `symbol`
126169
+ // being an external module symbol; the name it is re-exported by will be `symbolTableKey`
126170
+ // (which comes from the keys of `moduleSymbol.exports`.)
126171
+ // 3. Otherwise, we have a default/namespace import that can be imported by any name, and
126172
+ // `symbolTableKey` will be something undesirable like `export=` or `default`, so we try to
126173
+ // get a better name.
126174
+ var importedName = exportKind === 0 /* Named */ || ts.isExternalModuleSymbol(namedSymbol)
126153
126175
  ? ts.unescapeLeadingUnderscores(symbolTableKey)
126154
126176
  : ts.getNameForExportedSymbol(namedSymbol, scriptTarget);
126155
126177
  var moduleName = ts.stripQuotes(moduleSymbol.name);
@@ -126380,7 +126402,7 @@ var ts;
126380
126402
  cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, scriptTarget, checker);
126381
126403
  }
126382
126404
  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)) {
126405
+ if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
126384
126406
  cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, scriptTarget, checker);
126385
126407
  }
126386
126408
  });
@@ -129235,8 +129257,8 @@ var ts;
129235
129257
  }
129236
129258
  var checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker();
129237
129259
  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;
129260
+ var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
129261
+ 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
129262
  ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier);
129241
129263
  return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] };
129242
129264
  }
@@ -130131,8 +130153,9 @@ var ts;
130131
130153
  function isNewIdentifierDefinitionLocation() {
130132
130154
  if (contextToken) {
130133
130155
  var containingNodeKind = contextToken.parent.kind;
130156
+ var tokenKind = keywordForNode(contextToken);
130134
130157
  // Previous token may have been a keyword that was converted to an identifier.
130135
- switch (keywordForNode(contextToken)) {
130158
+ switch (tokenKind) {
130136
130159
  case 27 /* CommaToken */:
130137
130160
  return containingNodeKind === 207 /* CallExpression */ // func( a, |
130138
130161
  || containingNodeKind === 170 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
@@ -130167,10 +130190,12 @@ var ts;
130167
130190
  return containingNodeKind === 222 /* TemplateExpression */; // `aa ${|
130168
130191
  case 16 /* TemplateMiddle */:
130169
130192
  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 |
130193
+ case 131 /* AsyncKeyword */:
130194
+ return containingNodeKind === 168 /* MethodDeclaration */ // const obj = { async c|()
130195
+ || containingNodeKind === 295 /* ShorthandPropertyAssignment */; // const obj = { async c|
130196
+ }
130197
+ if (isClassMemberCompletionKeyword(tokenKind)) {
130198
+ return true;
130174
130199
  }
130175
130200
  }
130176
130201
  return false;
@@ -148475,11 +148500,11 @@ var ts;
148475
148500
  AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required";
148476
148501
  AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed";
148477
148502
  })(AddAsTypeOnly || (AddAsTypeOnly = {}));
148478
- function getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
148503
+ function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
148479
148504
  var compilerOptions = program.getCompilerOptions();
148480
148505
  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);
148506
+ ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)]
148507
+ : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, host, program, preferences, /*useAutoImportProvider*/ true);
148483
148508
  var useRequire = shouldUseRequire(sourceFile, program);
148484
148509
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position));
148485
148510
  var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
@@ -148517,7 +148542,7 @@ var ts;
148517
148542
  }
148518
148543
  }
148519
148544
  }
148520
- function getAllReExportingModules(importingFile, exportedSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
148545
+ function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
148521
148546
  var result = [];
148522
148547
  var compilerOptions = program.getCompilerOptions();
148523
148548
  var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) {
@@ -148530,12 +148555,12 @@ var ts;
148530
148555
  return;
148531
148556
  }
148532
148557
  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)) {
148558
+ if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
148534
148559
  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
148560
  }
148536
148561
  for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) {
148537
148562
  var exported = _a[_i];
148538
- if (exported.name === symbolName && ts.skipAlias(exported, checker) === exportedSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
148563
+ if (exported.name === symbolName && checker.getMergedSymbol(ts.skipAlias(exported, checker)) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
148539
148564
  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
148565
  }
148541
148566
  }
@@ -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>;
@@ -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.20211023";
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;
@@ -49947,8 +49952,8 @@ var ts;
49947
49952
  if (exportEquals !== moduleSymbol) {
49948
49953
  var type = getTypeOfSymbol(exportEquals);
49949
49954
  if (shouldTreatPropertiesOfExternalModuleAsExports(type)) {
49950
- getPropertiesOfType(type).forEach(function (symbol) {
49951
- cb(symbol, symbol.escapedName);
49955
+ forEachPropertyOfType(type, function (symbol, escapedName) {
49956
+ cb(symbol, escapedName);
49952
49957
  });
49953
49958
  }
49954
49959
  }
@@ -50280,12 +50285,15 @@ var ts;
50280
50285
  function getNamedMembers(members) {
50281
50286
  var result;
50282
50287
  members.forEach(function (symbol, id) {
50283
- if (!isReservedMemberName(id) && symbolIsValue(symbol)) {
50288
+ if (isNamedMember(symbol, id)) {
50284
50289
  (result || (result = [])).push(symbol);
50285
50290
  }
50286
50291
  });
50287
50292
  return result || ts.emptyArray;
50288
50293
  }
50294
+ function isNamedMember(member, escapedName) {
50295
+ return !isReservedMemberName(escapedName) && symbolIsValue(member);
50296
+ }
50289
50297
  function getNamedOrIndexSignatureMembers(members) {
50290
50298
  var result = getNamedMembers(members);
50291
50299
  var index = getIndexSymbolFromSymbolTable(members);
@@ -57118,6 +57126,16 @@ var ts;
57118
57126
  getPropertiesOfUnionOrIntersectionType(type) :
57119
57127
  getPropertiesOfObjectType(type);
57120
57128
  }
57129
+ function forEachPropertyOfType(type, action) {
57130
+ type = getReducedApparentType(type);
57131
+ if (type.flags & 3670016 /* StructuredType */) {
57132
+ resolveStructuredTypeMembers(type).members.forEach(function (symbol, escapedName) {
57133
+ if (isNamedMember(symbol, escapedName)) {
57134
+ action(symbol, escapedName);
57135
+ }
57136
+ });
57137
+ }
57138
+ }
57121
57139
  function isTypeInvalidDueToUnionDiscriminant(contextualType, obj) {
57122
57140
  var list = obj.properties;
57123
57141
  return list.some(function (property) {
@@ -60901,13 +60919,14 @@ var ts;
60901
60919
  }
60902
60920
  return result;
60903
60921
  }
60922
+ function isDistributionDependent(root) {
60923
+ return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
60924
+ isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
60925
+ }
60904
60926
  function getTypeFromConditionalTypeNode(node) {
60905
60927
  var links = getNodeLinks(node);
60906
60928
  if (!links.resolvedType) {
60907
60929
  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
60930
  var aliasSymbol = getAliasSymbolForTypeNode(node);
60912
60931
  var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
60913
60932
  var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
@@ -60916,8 +60935,7 @@ var ts;
60916
60935
  node: node,
60917
60936
  checkType: checkType,
60918
60937
  extendsType: getTypeFromTypeNode(node.extendsType),
60919
- isDistributive: isDistributive,
60920
- isDistributionDependent: isDistributionDependent,
60938
+ isDistributive: !!(checkType.flags & 262144 /* TypeParameter */),
60921
60939
  inferTypeParameters: getInferTypeParameters(node),
60922
60940
  outerTypeParameters: outerTypeParameters,
60923
60941
  instantiations: undefined,
@@ -64064,7 +64082,7 @@ var ts;
64064
64082
  // We check for a relationship to a conditional type target only when the conditional type has no
64065
64083
  // 'infer' positions and is not distributive or is distributive but doesn't reference the check type
64066
64084
  // parameter in either of the result types.
64067
- if (!c.root.inferTypeParameters && !c.root.isDistributionDependent) {
64085
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
64068
64086
  // Check if the conditional is always true or always false but still deferred for distribution purposes.
64069
64087
  var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
64070
64088
  var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
@@ -126146,10 +126164,14 @@ var ts;
126146
126164
  }
126147
126165
  var isDefault = exportKind === 1 /* Default */;
126148
126166
  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)
126167
+ // 1. A named export must be imported by its key in `moduleSymbol.exports` or `moduleSymbol.members`.
126168
+ // 2. A re-export merged with an export from a module augmentation can result in `symbol`
126169
+ // being an external module symbol; the name it is re-exported by will be `symbolTableKey`
126170
+ // (which comes from the keys of `moduleSymbol.exports`.)
126171
+ // 3. Otherwise, we have a default/namespace import that can be imported by any name, and
126172
+ // `symbolTableKey` will be something undesirable like `export=` or `default`, so we try to
126173
+ // get a better name.
126174
+ var importedName = exportKind === 0 /* Named */ || ts.isExternalModuleSymbol(namedSymbol)
126153
126175
  ? ts.unescapeLeadingUnderscores(symbolTableKey)
126154
126176
  : ts.getNameForExportedSymbol(namedSymbol, scriptTarget);
126155
126177
  var moduleName = ts.stripQuotes(moduleSymbol.name);
@@ -126380,7 +126402,7 @@ var ts;
126380
126402
  cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, scriptTarget, checker);
126381
126403
  }
126382
126404
  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)) {
126405
+ if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
126384
126406
  cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, scriptTarget, checker);
126385
126407
  }
126386
126408
  });
@@ -129235,8 +129257,8 @@ var ts;
129235
129257
  }
129236
129258
  var checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker();
129237
129259
  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;
129260
+ var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
129261
+ 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
129262
  ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier);
129241
129263
  return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] };
129242
129264
  }
@@ -130131,8 +130153,9 @@ var ts;
130131
130153
  function isNewIdentifierDefinitionLocation() {
130132
130154
  if (contextToken) {
130133
130155
  var containingNodeKind = contextToken.parent.kind;
130156
+ var tokenKind = keywordForNode(contextToken);
130134
130157
  // Previous token may have been a keyword that was converted to an identifier.
130135
- switch (keywordForNode(contextToken)) {
130158
+ switch (tokenKind) {
130136
130159
  case 27 /* CommaToken */:
130137
130160
  return containingNodeKind === 207 /* CallExpression */ // func( a, |
130138
130161
  || containingNodeKind === 170 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
@@ -130167,10 +130190,12 @@ var ts;
130167
130190
  return containingNodeKind === 222 /* TemplateExpression */; // `aa ${|
130168
130191
  case 16 /* TemplateMiddle */:
130169
130192
  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 |
130193
+ case 131 /* AsyncKeyword */:
130194
+ return containingNodeKind === 168 /* MethodDeclaration */ // const obj = { async c|()
130195
+ || containingNodeKind === 295 /* ShorthandPropertyAssignment */; // const obj = { async c|
130196
+ }
130197
+ if (isClassMemberCompletionKeyword(tokenKind)) {
130198
+ return true;
130174
130199
  }
130175
130200
  }
130176
130201
  return false;
@@ -148475,11 +148500,11 @@ var ts;
148475
148500
  AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required";
148476
148501
  AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed";
148477
148502
  })(AddAsTypeOnly || (AddAsTypeOnly = {}));
148478
- function getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
148503
+ function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
148479
148504
  var compilerOptions = program.getCompilerOptions();
148480
148505
  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);
148506
+ ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)]
148507
+ : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, host, program, preferences, /*useAutoImportProvider*/ true);
148483
148508
  var useRequire = shouldUseRequire(sourceFile, program);
148484
148509
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position));
148485
148510
  var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
@@ -148517,7 +148542,7 @@ var ts;
148517
148542
  }
148518
148543
  }
148519
148544
  }
148520
- function getAllReExportingModules(importingFile, exportedSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
148545
+ function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
148521
148546
  var result = [];
148522
148547
  var compilerOptions = program.getCompilerOptions();
148523
148548
  var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) {
@@ -148530,12 +148555,12 @@ var ts;
148530
148555
  return;
148531
148556
  }
148532
148557
  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)) {
148558
+ if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
148534
148559
  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
148560
  }
148536
148561
  for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) {
148537
148562
  var exported = _a[_i];
148538
- if (exported.name === symbolName && ts.skipAlias(exported, checker) === exportedSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
148563
+ if (exported.name === symbolName && checker.getMergedSymbol(ts.skipAlias(exported, checker)) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
148539
148564
  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
148565
  }
148541
148566
  }
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-dev.20211022";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20211023";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -8130,6 +8130,7 @@ var ts;
8130
8130
  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."),
8131
8131
  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."),
8132
8132
  _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."),
8133
+ _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."),
8133
8134
  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'"),
8134
8135
  Imported_via_0_from_file_1: diag(1393, ts.DiagnosticCategory.Message, "Imported_via_0_from_file_1_1393", "Imported via {0} from file '{1}'"),
8135
8136
  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}'"),
@@ -31922,7 +31923,10 @@ var ts;
31922
31923
  case 12 /* ObjectLiteralMembers */: return parseErrorAtCurrentToken(ts.Diagnostics.Property_assignment_expected);
31923
31924
  case 15 /* ArrayLiteralMembers */: return parseErrorAtCurrentToken(ts.Diagnostics.Expression_or_comma_expected);
31924
31925
  case 17 /* JSDocParameters */: return parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
31925
- case 16 /* Parameters */: return parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
31926
+ case 16 /* Parameters */:
31927
+ return ts.isKeyword(token())
31928
+ ? parseErrorAtCurrentToken(ts.Diagnostics._0_is_not_allowed_as_a_parameter_name, ts.tokenToString(token()))
31929
+ : parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
31926
31930
  case 19 /* TypeParameters */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_parameter_declaration_expected);
31927
31931
  case 20 /* TypeArguments */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_argument_expected);
31928
31932
  case 21 /* TupleElementTypes */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_expected);
@@ -45682,6 +45686,7 @@ var ts;
45682
45686
  case 168 /* MethodDeclaration */:
45683
45687
  case 171 /* GetAccessor */:
45684
45688
  case 172 /* SetAccessor */:
45689
+ case 169 /* ClassStaticBlockDeclaration */:
45685
45690
  // this.foo assignment in a JavaScript class
45686
45691
  // Bind this property to the containing class
45687
45692
  var containingClass = thisContainer.parent;
@@ -49742,8 +49747,8 @@ var ts;
49742
49747
  if (exportEquals !== moduleSymbol) {
49743
49748
  var type = getTypeOfSymbol(exportEquals);
49744
49749
  if (shouldTreatPropertiesOfExternalModuleAsExports(type)) {
49745
- getPropertiesOfType(type).forEach(function (symbol) {
49746
- cb(symbol, symbol.escapedName);
49750
+ forEachPropertyOfType(type, function (symbol, escapedName) {
49751
+ cb(symbol, escapedName);
49747
49752
  });
49748
49753
  }
49749
49754
  }
@@ -50075,12 +50080,15 @@ var ts;
50075
50080
  function getNamedMembers(members) {
50076
50081
  var result;
50077
50082
  members.forEach(function (symbol, id) {
50078
- if (!isReservedMemberName(id) && symbolIsValue(symbol)) {
50083
+ if (isNamedMember(symbol, id)) {
50079
50084
  (result || (result = [])).push(symbol);
50080
50085
  }
50081
50086
  });
50082
50087
  return result || ts.emptyArray;
50083
50088
  }
50089
+ function isNamedMember(member, escapedName) {
50090
+ return !isReservedMemberName(escapedName) && symbolIsValue(member);
50091
+ }
50084
50092
  function getNamedOrIndexSignatureMembers(members) {
50085
50093
  var result = getNamedMembers(members);
50086
50094
  var index = getIndexSymbolFromSymbolTable(members);
@@ -56913,6 +56921,16 @@ var ts;
56913
56921
  getPropertiesOfUnionOrIntersectionType(type) :
56914
56922
  getPropertiesOfObjectType(type);
56915
56923
  }
56924
+ function forEachPropertyOfType(type, action) {
56925
+ type = getReducedApparentType(type);
56926
+ if (type.flags & 3670016 /* StructuredType */) {
56927
+ resolveStructuredTypeMembers(type).members.forEach(function (symbol, escapedName) {
56928
+ if (isNamedMember(symbol, escapedName)) {
56929
+ action(symbol, escapedName);
56930
+ }
56931
+ });
56932
+ }
56933
+ }
56916
56934
  function isTypeInvalidDueToUnionDiscriminant(contextualType, obj) {
56917
56935
  var list = obj.properties;
56918
56936
  return list.some(function (property) {
@@ -60696,13 +60714,14 @@ var ts;
60696
60714
  }
60697
60715
  return result;
60698
60716
  }
60717
+ function isDistributionDependent(root) {
60718
+ return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
60719
+ isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
60720
+ }
60699
60721
  function getTypeFromConditionalTypeNode(node) {
60700
60722
  var links = getNodeLinks(node);
60701
60723
  if (!links.resolvedType) {
60702
60724
  var checkType = getTypeFromTypeNode(node.checkType);
60703
- var isDistributive = !!(checkType.flags & 262144 /* TypeParameter */);
60704
- var isDistributionDependent = isDistributive && (isTypeParameterPossiblyReferenced(checkType, node.trueType) ||
60705
- isTypeParameterPossiblyReferenced(checkType, node.falseType));
60706
60725
  var aliasSymbol = getAliasSymbolForTypeNode(node);
60707
60726
  var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
60708
60727
  var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
@@ -60711,8 +60730,7 @@ var ts;
60711
60730
  node: node,
60712
60731
  checkType: checkType,
60713
60732
  extendsType: getTypeFromTypeNode(node.extendsType),
60714
- isDistributive: isDistributive,
60715
- isDistributionDependent: isDistributionDependent,
60733
+ isDistributive: !!(checkType.flags & 262144 /* TypeParameter */),
60716
60734
  inferTypeParameters: getInferTypeParameters(node),
60717
60735
  outerTypeParameters: outerTypeParameters,
60718
60736
  instantiations: undefined,
@@ -63859,7 +63877,7 @@ var ts;
63859
63877
  // We check for a relationship to a conditional type target only when the conditional type has no
63860
63878
  // 'infer' positions and is not distributive or is distributive but doesn't reference the check type
63861
63879
  // parameter in either of the result types.
63862
- if (!c.root.inferTypeParameters && !c.root.isDistributionDependent) {
63880
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
63863
63881
  // Check if the conditional is always true or always false but still deferred for distribution purposes.
63864
63882
  var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
63865
63883
  var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.5.0-dev.20211022",
5
+ "version": "4.5.0-dev.20211023",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [