typescript 4.5.0-dev.20211020 → 4.5.0-dev.20211024

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/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.20211020";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20211024";
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}'"),
@@ -20187,7 +20188,7 @@ var ts;
20187
20188
  includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"),
20188
20189
  includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"),
20189
20190
  excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"),
20190
- basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames)
20191
+ basePaths: getBasePaths(absolutePath, includes, useCaseSensitiveFileNames)
20191
20192
  };
20192
20193
  }
20193
20194
  ts.getFileMatcherPatterns = getFileMatcherPatterns;
@@ -20209,20 +20210,20 @@ var ts;
20209
20210
  var visited = new ts.Map();
20210
20211
  var toCanonical = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
20211
20212
  for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {
20212
- var basePath = _a[_i];
20213
- if (directoryExists(basePath)) {
20214
- visitDirectory(basePath, ts.combinePaths(currentDirectory, basePath), depth);
20213
+ var absoluteBasePath = _a[_i];
20214
+ if (directoryExists(absoluteBasePath)) {
20215
+ visitDirectory(absoluteBasePath, depth);
20215
20216
  }
20216
20217
  }
20217
20218
  return ts.flatten(results);
20218
- function visitDirectory(path, absolutePath, depth) {
20219
+ function visitDirectory(absolutePath, depth) {
20219
20220
  var canonicalPath = toCanonical(realpath(absolutePath));
20220
20221
  if (visited.has(canonicalPath))
20221
20222
  return;
20222
20223
  visited.set(canonicalPath, true);
20223
- var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;
20224
+ var _a = getFileSystemEntries(absolutePath), files = _a.files, directories = _a.directories;
20224
20225
  var _loop_1 = function (current) {
20225
- var name = ts.combinePaths(path, current);
20226
+ var name = ts.combinePaths(absolutePath, current);
20226
20227
  var absoluteName = ts.combinePaths(absolutePath, current);
20227
20228
  if (extensions && !ts.fileExtensionIsOneOf(name, extensions))
20228
20229
  return "continue";
@@ -20250,11 +20251,10 @@ var ts;
20250
20251
  }
20251
20252
  for (var _c = 0, _d = ts.sort(directories, ts.compareStringsCaseSensitive); _c < _d.length; _c++) {
20252
20253
  var current = _d[_c];
20253
- var name = ts.combinePaths(path, current);
20254
20254
  var absoluteName = ts.combinePaths(absolutePath, current);
20255
20255
  if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&
20256
20256
  (!excludeRegex || !excludeRegex.test(absoluteName))) {
20257
- visitDirectory(name, absoluteName, depth);
20257
+ visitDirectory(absoluteName, depth);
20258
20258
  }
20259
20259
  }
20260
20260
  }
@@ -20262,10 +20262,11 @@ var ts;
20262
20262
  ts.matchFiles = matchFiles;
20263
20263
  /**
20264
20264
  * Computes the unique non-wildcard base paths amongst the provided include patterns.
20265
+ * @returns Absolute directory paths
20265
20266
  */
20266
- function getBasePaths(path, includes, useCaseSensitiveFileNames) {
20267
+ function getBasePaths(absoluteTsconfigPath, includes, useCaseSensitiveFileNames) {
20267
20268
  // Storage for our results in the form of literal paths (e.g. the paths as written by the user).
20268
- var basePaths = [path];
20269
+ var basePaths = [absoluteTsconfigPath];
20269
20270
  if (includes) {
20270
20271
  // Storage for literal base paths amongst the include patterns.
20271
20272
  var includeBasePaths = [];
@@ -20273,14 +20274,14 @@ var ts;
20273
20274
  var include = includes_1[_i];
20274
20275
  // We also need to check the relative paths by converting them to absolute and normalizing
20275
20276
  // in case they escape the base path (e.g "..\somedirectory")
20276
- var absolute = ts.isRootedDiskPath(include) ? include : ts.normalizePath(ts.combinePaths(path, include));
20277
+ var absoluteIncludePath = ts.isRootedDiskPath(include) ? include : ts.normalizePath(ts.combinePaths(absoluteTsconfigPath, include));
20277
20278
  // Append the literal and canonical candidate base paths.
20278
- includeBasePaths.push(getIncludeBasePath(absolute));
20279
+ includeBasePaths.push(getIncludeBasePath(absoluteIncludePath));
20279
20280
  }
20280
20281
  // Sort the offsets array using either the literal or canonical path representations.
20281
20282
  includeBasePaths.sort(ts.getStringComparer(!useCaseSensitiveFileNames));
20282
20283
  var _loop_2 = function (includeBasePath) {
20283
- if (ts.every(basePaths, function (basePath) { return !ts.containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) {
20284
+ if (ts.every(basePaths, function (basePath) { return !ts.containsPath(basePath, includeBasePath, absoluteTsconfigPath, !useCaseSensitiveFileNames); })) {
20284
20285
  basePaths.push(includeBasePath);
20285
20286
  }
20286
20287
  };
@@ -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) {
@@ -60593,12 +60611,6 @@ var ts;
60593
60611
  }
60594
60612
  return type[cache] = type;
60595
60613
  }
60596
- function isConditionalTypeAlwaysTrueDisregardingInferTypes(type) {
60597
- var extendsInferParamMapper = type.root.inferTypeParameters && createTypeMapper(type.root.inferTypeParameters, ts.map(type.root.inferTypeParameters, function () { return wildcardType; }));
60598
- var checkType = type.checkType;
60599
- var extendsType = type.extendsType;
60600
- return isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(instantiateType(extendsType, extendsInferParamMapper)));
60601
- }
60602
60614
  function getSimplifiedConditionalType(type, writing) {
60603
60615
  var checkType = type.checkType;
60604
60616
  var extendsType = type.extendsType;
@@ -60907,6 +60919,10 @@ var ts;
60907
60919
  }
60908
60920
  return result;
60909
60921
  }
60922
+ function isDistributionDependent(root) {
60923
+ return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
60924
+ isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
60925
+ }
60910
60926
  function getTypeFromConditionalTypeNode(node) {
60911
60927
  var links = getNodeLinks(node);
60912
60928
  if (!links.resolvedType) {
@@ -64063,31 +64079,21 @@ var ts;
64063
64079
  return 3 /* Maybe */;
64064
64080
  }
64065
64081
  var c = target;
64066
- // Check if the conditional is always true or always false but still deferred for distribution purposes
64067
- var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
64068
- var skipFalse = !skipTrue && isConditionalTypeAlwaysTrueDisregardingInferTypes(c);
64069
- // Instantiate with a replacement mapper if the conditional is distributive, replacing the check type with a clone of itself,
64070
- // this way {x: string | number, y: string | number} -> (T extends T ? { x: T, y: T } : never) appropriately _fails_ when
64071
- // T = string | number (since that will end up distributing and producing `{x: string, y: string} | {x: number, y: number}`,
64072
- // to which `{x: string | number, y: string | number}` isn't assignable)
64073
- var distributionMapper = void 0;
64074
- var checkVar = getActualTypeVariable(c.root.checkType);
64075
- if (c.root.isDistributive && checkVar.flags & 262144 /* TypeParameter */) {
64076
- var newParam = cloneTypeParameter(checkVar);
64077
- distributionMapper = prependTypeMapping(checkVar, newParam, c.mapper);
64078
- newParam.mapper = distributionMapper;
64079
- }
64080
- // TODO: Find a nice way to include potential conditional type breakdowns in error output, if they seem good (they usually don't)
64081
- var expanding = isDeeplyNestedType(target, targetStack, targetDepth);
64082
- var localResult = expanding ? 3 /* Maybe */ : undefined;
64083
- if (skipTrue || expanding || (localResult = isRelatedTo(source, distributionMapper ? instantiateType(getTypeFromTypeNode(c.root.node.trueType), distributionMapper) : getTrueTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false))) {
64084
- if (!skipFalse && !expanding) {
64085
- localResult = (localResult || 3 /* Maybe */) & isRelatedTo(source, distributionMapper ? instantiateType(getTypeFromTypeNode(c.root.node.falseType), distributionMapper) : getFalseTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false);
64086
- }
64087
- }
64088
- if (localResult) {
64089
- resetErrorInfo(saveErrorInfo);
64090
- return localResult;
64082
+ // We check for a relationship to a conditional type target only when the conditional type has no
64083
+ // 'infer' positions and is not distributive or is distributive but doesn't reference the check type
64084
+ // parameter in either of the result types.
64085
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
64086
+ // Check if the conditional is always true or always false but still deferred for distribution purposes.
64087
+ var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
64088
+ var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
64089
+ // TODO: Find a nice way to include potential conditional type breakdowns in error output, if they seem good (they usually don't)
64090
+ if (result = skipTrue ? -1 /* True */ : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false)) {
64091
+ result &= skipFalse ? -1 /* True */ : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false);
64092
+ if (result) {
64093
+ resetErrorInfo(saveErrorInfo);
64094
+ return result;
64095
+ }
64096
+ }
64091
64097
  }
64092
64098
  }
64093
64099
  else if (target.flags & 134217728 /* TemplateLiteral */) {
@@ -125193,9 +125199,9 @@ var ts;
125193
125199
  return displayPart(text, ts.SymbolDisplayPartKind.linkText);
125194
125200
  }
125195
125201
  ts.linkTextPart = linkTextPart;
125196
- function linkNamePart(name, target) {
125202
+ function linkNamePart(text, target) {
125197
125203
  return {
125198
- text: ts.getTextOfNode(name),
125204
+ text: text,
125199
125205
  kind: ts.SymbolDisplayPartKind[ts.SymbolDisplayPartKind.linkName],
125200
125206
  target: {
125201
125207
  fileName: ts.getSourceFileOfNode(target).fileName,
@@ -125220,20 +125226,41 @@ var ts;
125220
125226
  }
125221
125227
  else {
125222
125228
  var symbol = checker === null || checker === void 0 ? void 0 : checker.getSymbolAtLocation(link.name);
125229
+ var suffix = findLinkNameEnd(link.text);
125230
+ var name = ts.getTextOfNode(link.name) + link.text.slice(0, suffix);
125231
+ var text = link.text.slice(suffix);
125223
125232
  var decl = (symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) || ((_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]);
125224
125233
  if (decl) {
125225
- parts.push(linkNamePart(link.name, decl));
125226
- if (link.text)
125227
- parts.push(linkTextPart(link.text));
125234
+ parts.push(linkNamePart(name, decl));
125235
+ if (text)
125236
+ parts.push(linkTextPart(text));
125228
125237
  }
125229
125238
  else {
125230
- parts.push(linkTextPart(ts.getTextOfNode(link.name) + " " + link.text));
125239
+ parts.push(linkTextPart(name + (suffix ? "" : " ") + text));
125231
125240
  }
125232
125241
  }
125233
125242
  parts.push(linkPart("}"));
125234
125243
  return parts;
125235
125244
  }
125236
125245
  ts.buildLinkParts = buildLinkParts;
125246
+ function findLinkNameEnd(text) {
125247
+ if (text.indexOf("()") === 0)
125248
+ return 2;
125249
+ if (text[0] !== "<")
125250
+ return 0;
125251
+ var brackets = 0;
125252
+ var i = 0;
125253
+ while (i < text.length) {
125254
+ if (text[i] === "<")
125255
+ brackets++;
125256
+ if (text[i] === ">")
125257
+ brackets--;
125258
+ i++;
125259
+ if (!brackets)
125260
+ return i;
125261
+ }
125262
+ return 0;
125263
+ }
125237
125264
  var carriageReturnLineFeed = "\r\n";
125238
125265
  /**
125239
125266
  * The default is CRLF.
@@ -126137,10 +126164,14 @@ var ts;
126137
126164
  }
126138
126165
  var isDefault = exportKind === 1 /* Default */;
126139
126166
  var namedSymbol = isDefault && ts.getLocalSymbolForExportDefault(symbol) || symbol;
126140
- // A re-export merged with an export from a module augmentation can result in `symbol`
126141
- // being an external module symbol; the name it is re-exported by will be `symbolTableKey`
126142
- // (which comes from the keys of `moduleSymbol.exports`.)
126143
- 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)
126144
126175
  ? ts.unescapeLeadingUnderscores(symbolTableKey)
126145
126176
  : ts.getNameForExportedSymbol(namedSymbol, scriptTarget);
126146
126177
  var moduleName = ts.stripQuotes(moduleSymbol.name);
@@ -126371,7 +126402,7 @@ var ts;
126371
126402
  cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, scriptTarget, checker);
126372
126403
  }
126373
126404
  checker.forEachExportAndPropertyOfModule(moduleSymbol, function (exported, key) {
126374
- 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)) {
126375
126406
  cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, scriptTarget, checker);
126376
126407
  }
126377
126408
  });
@@ -129226,8 +129257,8 @@ var ts;
129226
129257
  }
129227
129258
  var checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker();
129228
129259
  var moduleSymbol = origin.moduleSymbol;
129229
- var exportedSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
129230
- 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;
129231
129262
  ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier);
129232
129263
  return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] };
129233
129264
  }
@@ -130122,8 +130153,9 @@ var ts;
130122
130153
  function isNewIdentifierDefinitionLocation() {
130123
130154
  if (contextToken) {
130124
130155
  var containingNodeKind = contextToken.parent.kind;
130156
+ var tokenKind = keywordForNode(contextToken);
130125
130157
  // Previous token may have been a keyword that was converted to an identifier.
130126
- switch (keywordForNode(contextToken)) {
130158
+ switch (tokenKind) {
130127
130159
  case 27 /* CommaToken */:
130128
130160
  return containingNodeKind === 207 /* CallExpression */ // func( a, |
130129
130161
  || containingNodeKind === 170 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
@@ -130158,10 +130190,12 @@ var ts;
130158
130190
  return containingNodeKind === 222 /* TemplateExpression */; // `aa ${|
130159
130191
  case 16 /* TemplateMiddle */:
130160
130192
  return containingNodeKind === 232 /* TemplateSpan */; // `aa ${10} dd ${|
130161
- case 123 /* PublicKeyword */:
130162
- case 121 /* PrivateKeyword */:
130163
- case 122 /* ProtectedKeyword */:
130164
- 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;
130165
130199
  }
130166
130200
  }
130167
130201
  return false;
@@ -148466,11 +148500,11 @@ var ts;
148466
148500
  AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required";
148467
148501
  AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed";
148468
148502
  })(AddAsTypeOnly || (AddAsTypeOnly = {}));
148469
- function getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
148503
+ function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
148470
148504
  var compilerOptions = program.getCompilerOptions();
148471
148505
  var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name))
148472
- ? [getSymbolExportInfoForSymbol(exportedSymbol, moduleSymbol, program, host)]
148473
- : 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);
148474
148508
  var useRequire = shouldUseRequire(sourceFile, program);
148475
148509
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position));
148476
148510
  var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
@@ -148508,7 +148542,7 @@ var ts;
148508
148542
  }
148509
148543
  }
148510
148544
  }
148511
- function getAllReExportingModules(importingFile, exportedSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
148545
+ function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
148512
148546
  var result = [];
148513
148547
  var compilerOptions = program.getCompilerOptions();
148514
148548
  var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) {
@@ -148521,12 +148555,12 @@ var ts;
148521
148555
  return;
148522
148556
  }
148523
148557
  var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
148524
- 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)) {
148525
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 });
148526
148560
  }
148527
148561
  for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) {
148528
148562
  var exported = _a[_i];
148529
- 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)) {
148530
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 });
148531
148565
  }
148532
148566
  }
@@ -148777,12 +148811,14 @@ var ts;
148777
148811
  }
148778
148812
  var allowsImportingSpecifier = ts.createPackageJsonImportFilter(sourceFile, preferences, host).allowsImportingSpecifier;
148779
148813
  return fixes.reduce(function (best, fix) {
148814
+ // Takes true branch of conditional if `fix` is better than `best`
148780
148815
  return compareModuleSpecifiers(fix, best, sourceFile, program, allowsImportingSpecifier) === -1 /* LessThan */ ? fix : best;
148781
148816
  });
148782
148817
  }
148818
+ /** @returns `Comparison.LessThan` if `a` is better than `b`. */
148783
148819
  function compareModuleSpecifiers(a, b, importingFile, program, allowsImportingSpecifier) {
148784
148820
  if (a.kind !== 0 /* UseNamespace */ && b.kind !== 0 /* UseNamespace */) {
148785
- return ts.compareBooleans(allowsImportingSpecifier(a.moduleSpecifier), allowsImportingSpecifier(b.moduleSpecifier))
148821
+ return ts.compareBooleans(allowsImportingSpecifier(b.moduleSpecifier), allowsImportingSpecifier(a.moduleSpecifier))
148786
148822
  || compareNodeCoreModuleSpecifiers(a.moduleSpecifier, b.moduleSpecifier, importingFile, program)
148787
148823
  || ts.compareNumberOfDirectorySeparators(a.moduleSpecifier, b.moduleSpecifier);
148788
148824
  }
@@ -151434,7 +151470,8 @@ var ts;
151434
151470
  insertBefore = ts.findChildOfKind(containingFunction, 98 /* FunctionKeyword */, sourceFile);
151435
151471
  break;
151436
151472
  case 213 /* ArrowFunction */:
151437
- insertBefore = ts.findChildOfKind(containingFunction, 20 /* OpenParenToken */, sourceFile) || ts.first(containingFunction.parameters);
151473
+ var kind = containingFunction.typeParameters ? 29 /* LessThanToken */ : 20 /* OpenParenToken */;
151474
+ insertBefore = ts.findChildOfKind(containingFunction, kind, sourceFile) || ts.first(containingFunction.parameters);
151438
151475
  break;
151439
151476
  default:
151440
151477
  return;