typescript 4.9.0-dev.20221007 → 4.9.0-dev.20221012

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/protocol.d.ts CHANGED
@@ -860,12 +860,14 @@ declare namespace ts.server.protocol {
860
860
  command: CommandTypes.References;
861
861
  }
862
862
  interface ReferencesResponseItem extends FileSpanWithContext {
863
- /** Text of line containing the reference. Including this
864
- * with the response avoids latency of editor loading files
865
- * to show text of reference line (the server already has
866
- * loaded the referencing files).
863
+ /**
864
+ * Text of line containing the reference. Including this
865
+ * with the response avoids latency of editor loading files
866
+ * to show text of reference line (the server already has loaded the referencing files).
867
+ *
868
+ * If {@link UserPreferences.disableLineTextInReferences} is enabled, the property won't be filled
867
869
  */
868
- lineText: string;
870
+ lineText?: string;
869
871
  /**
870
872
  * True if reference is a write location, false otherwise.
871
873
  */
@@ -2711,6 +2713,10 @@ declare namespace ts.server.protocol {
2711
2713
  readonly includeInlayFunctionLikeReturnTypeHints?: boolean;
2712
2714
  readonly includeInlayEnumMemberValueHints?: boolean;
2713
2715
  readonly autoImportFileExcludePatterns?: string[];
2716
+ /**
2717
+ * Indicates whether {@link ReferencesResponseItem.lineText} is supported.
2718
+ */
2719
+ readonly disableLineTextInReferences?: boolean;
2714
2720
  }
2715
2721
  interface CompilerOptions {
2716
2722
  allowJs?: boolean;
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.9";
72
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221007");
72
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221012");
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -49626,7 +49626,17 @@ var ts;
49626
49626
  return !!(ts.getObjectFlags(type) & 32 && getMappedTypeModifiers(type) & 4);
49627
49627
  }
49628
49628
  function isGenericMappedType(type) {
49629
- return !!(ts.getObjectFlags(type) & 32) && isGenericIndexType(getConstraintTypeFromMappedType(type));
49629
+ if (ts.getObjectFlags(type) & 32) {
49630
+ var constraint = getConstraintTypeFromMappedType(type);
49631
+ if (isGenericIndexType(constraint)) {
49632
+ return true;
49633
+ }
49634
+ var nameType = getNameTypeFromMappedType(type);
49635
+ if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) {
49636
+ return true;
49637
+ }
49638
+ }
49639
+ return false;
49630
49640
  }
49631
49641
  function resolveStructuredTypeMembers(type) {
49632
49642
  if (!type.members) {
@@ -52559,8 +52569,13 @@ var ts;
52559
52569
  return getStringLiteralType(text);
52560
52570
  }
52561
52571
  newTexts.push(text);
52562
- if (ts.every(newTexts, function (t) { return t === ""; }) && ts.every(newTypes, function (t) { return !!(t.flags & 4); })) {
52563
- return stringType;
52572
+ if (ts.every(newTexts, function (t) { return t === ""; })) {
52573
+ if (ts.every(newTypes, function (t) { return !!(t.flags & 4); })) {
52574
+ return stringType;
52575
+ }
52576
+ if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) {
52577
+ return newTypes[0];
52578
+ }
52564
52579
  }
52565
52580
  var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join(""));
52566
52581
  var type = templateLiteralTypes.get(id);
@@ -52619,11 +52634,12 @@ var ts;
52619
52634
  }
52620
52635
  function getStringMappingType(symbol, type) {
52621
52636
  return type.flags & (1048576 | 131072) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) :
52622
- type.flags & 268435456 && symbol === type.symbol ? type :
52623
- isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456) ? getTemplateLiteralType(["", ""], [type]) : type) :
52624
- type.flags & 128 ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
52625
- type.flags & 134217728 ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
52626
- type;
52637
+ type.flags & 128 ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
52638
+ type.flags & 134217728 ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
52639
+ type.flags & 268435456 && symbol === type.symbol ? type :
52640
+ type.flags & (1 | 4 || type.flags & 268435456) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) :
52641
+ isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) :
52642
+ type;
52627
52643
  }
52628
52644
  function applyStringMapping(symbol, str) {
52629
52645
  switch (intrinsicTypeKinds.get(symbol.escapedName)) {
@@ -52887,10 +52903,11 @@ var ts;
52887
52903
  accessNode;
52888
52904
  }
52889
52905
  function isPatternLiteralPlaceholderType(type) {
52890
- return !!(type.flags & (1 | 4 | 8 | 64)) || !!(type.flags & 268435456 && isPatternLiteralPlaceholderType(type.type));
52906
+ return !!(type.flags & (1 | 4 | 8 | 64)) || isPatternLiteralType(type);
52891
52907
  }
52892
52908
  function isPatternLiteralType(type) {
52893
- return !!(type.flags & 134217728) && ts.every(type.types, isPatternLiteralPlaceholderType);
52909
+ return !!(type.flags & 134217728) && ts.every(type.types, isPatternLiteralPlaceholderType) ||
52910
+ !!(type.flags & 268435456) && isPatternLiteralPlaceholderType(type.type);
52894
52911
  }
52895
52912
  function isGenericType(type) {
52896
52913
  return !!getGenericObjectFlags(type);
@@ -58240,7 +58257,7 @@ var ts;
58240
58257
  && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
58241
58258
  }
58242
58259
  function isMemberOfStringMapping(source, target) {
58243
- if (target.flags & (4 | 3)) {
58260
+ if (target.flags & (4 | 1)) {
58244
58261
  return true;
58245
58262
  }
58246
58263
  if (target.flags & 134217728) {
package/lib/tsserver.js CHANGED
@@ -109,7 +109,7 @@ var ts;
109
109
  // The following is baselined as a literal template type without intervention
110
110
  /** The version of the TypeScript compiler release */
111
111
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
112
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221007");
112
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221012");
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -59873,7 +59873,20 @@ var ts;
59873
59873
  return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(type) & 4 /* MappedTypeModifiers.IncludeOptional */);
59874
59874
  }
59875
59875
  function isGenericMappedType(type) {
59876
- return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) && isGenericIndexType(getConstraintTypeFromMappedType(type));
59876
+ if (ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) {
59877
+ var constraint = getConstraintTypeFromMappedType(type);
59878
+ if (isGenericIndexType(constraint)) {
59879
+ return true;
59880
+ }
59881
+ // A mapped type is generic if the 'as' clause references generic types other than the iteration type.
59882
+ // To determine this, we substitute the constraint type (that we now know isn't generic) for the iteration
59883
+ // type and check whether the resulting type is generic.
59884
+ var nameType = getNameTypeFromMappedType(type);
59885
+ if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) {
59886
+ return true;
59887
+ }
59888
+ }
59889
+ return false;
59877
59890
  }
59878
59891
  function resolveStructuredTypeMembers(type) {
59879
59892
  if (!type.members) {
@@ -63193,8 +63206,14 @@ var ts;
63193
63206
  return getStringLiteralType(text);
63194
63207
  }
63195
63208
  newTexts.push(text);
63196
- if (ts.every(newTexts, function (t) { return t === ""; }) && ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) {
63197
- return stringType;
63209
+ if (ts.every(newTexts, function (t) { return t === ""; })) {
63210
+ if (ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) {
63211
+ return stringType;
63212
+ }
63213
+ // Normalize `${Mapping<xxx>}` into Mapping<xxx>
63214
+ if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) {
63215
+ return newTypes[0];
63216
+ }
63198
63217
  }
63199
63218
  var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join(""));
63200
63219
  var type = templateLiteralTypes.get(id);
@@ -63253,12 +63272,14 @@ var ts;
63253
63272
  }
63254
63273
  function getStringMappingType(symbol, type) {
63255
63274
  return type.flags & (1048576 /* TypeFlags.Union */ | 131072 /* TypeFlags.Never */) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) :
63256
- // Mapping<Mapping<T>> === Mapping<T>
63257
- type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type :
63258
- isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456 /* TypeFlags.StringMapping */) ? getTemplateLiteralType(["", ""], [type]) : type) :
63259
- type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
63260
- type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
63261
- type;
63275
+ type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
63276
+ type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
63277
+ // Mapping<Mapping<T>> === Mapping<T>
63278
+ type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type :
63279
+ type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ || type.flags & 268435456 /* TypeFlags.StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) :
63280
+ // This handles Mapping<`${number}`> and Mapping<`${bigint}`>
63281
+ isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) :
63282
+ type;
63262
63283
  }
63263
63284
  function applyStringMapping(symbol, str) {
63264
63285
  switch (intrinsicTypeKinds.get(symbol.escapedName)) {
@@ -63537,10 +63558,11 @@ var ts;
63537
63558
  accessNode;
63538
63559
  }
63539
63560
  function isPatternLiteralPlaceholderType(type) {
63540
- return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || !!(type.flags & 268435456 /* TypeFlags.StringMapping */ && isPatternLiteralPlaceholderType(type.type));
63561
+ return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || isPatternLiteralType(type);
63541
63562
  }
63542
63563
  function isPatternLiteralType(type) {
63543
- return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType);
63564
+ return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType) ||
63565
+ !!(type.flags & 268435456 /* TypeFlags.StringMapping */) && isPatternLiteralPlaceholderType(type.type);
63544
63566
  }
63545
63567
  function isGenericType(type) {
63546
63568
  return !!getGenericObjectFlags(type);
@@ -69727,7 +69749,7 @@ var ts;
69727
69749
  && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
69728
69750
  }
69729
69751
  function isMemberOfStringMapping(source, target) {
69730
- if (target.flags & (4 /* TypeFlags.String */ | 3 /* TypeFlags.AnyOrUnknown */)) {
69752
+ if (target.flags & (4 /* TypeFlags.String */ | 1 /* TypeFlags.Any */)) {
69731
69753
  return true;
69732
69754
  }
69733
69755
  if (target.flags & 134217728 /* TypeFlags.TemplateLiteral */) {
@@ -146214,8 +146236,8 @@ var ts;
146214
146236
  }
146215
146237
  if (ts.scanner.getToken() === 15 /* SyntaxKind.TemplateHead */) {
146216
146238
  var stack = [ts.scanner.getToken()];
146217
- var token = ts.scanner.scan();
146218
146239
  loop: while (ts.length(stack)) {
146240
+ var token = ts.scanner.scan();
146219
146241
  switch (token) {
146220
146242
  case 1 /* SyntaxKind.EndOfFileToken */:
146221
146243
  break loop;
@@ -146243,7 +146265,6 @@ var ts;
146243
146265
  }
146244
146266
  break;
146245
146267
  }
146246
- token = ts.scanner.scan();
146247
146268
  }
146248
146269
  nextToken();
146249
146270
  }
@@ -148722,7 +148743,7 @@ var ts;
148722
148743
  tags = signature.getJsDocTags();
148723
148744
  if (allSignatures.length > 1 && documentation.length === 0 && tags.length === 0) {
148724
148745
  documentation = allSignatures[0].getDocumentationComment(typeChecker);
148725
- tags = allSignatures[0].getJsDocTags();
148746
+ tags = allSignatures[0].getJsDocTags().filter(function (tag) { return tag.name !== "deprecated"; }); // should only include @deprecated JSDoc tag on the first overload (#49368)
148726
148747
  }
148727
148748
  }
148728
148749
  function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) {
@@ -163732,7 +163753,6 @@ var ts;
163732
163753
  var start = cursorRequest ? getExtractableParent(startToken) : ts.getParentNodeInSpan(startToken, sourceFile, adjustedSpan);
163733
163754
  // Do the same for the ending position
163734
163755
  var end = cursorRequest ? start : ts.getParentNodeInSpan(endToken, sourceFile, adjustedSpan);
163735
- var declarations = [];
163736
163756
  // We'll modify these flags as we walk the tree to collect data
163737
163757
  // about what things need to be done as part of the extraction.
163738
163758
  var rangeFacts = RangeFacts.None;
@@ -163775,7 +163795,7 @@ var ts;
163775
163795
  // the expression.
163776
163796
  return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
163777
163797
  }
163778
- return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations, thisNode: thisNode } };
163798
+ return { targetRange: { range: statements, facts: rangeFacts, thisNode: thisNode } };
163779
163799
  }
163780
163800
  if (ts.isReturnStatement(start) && !start.expression) {
163781
163801
  // Makes no sense to extract an expression-less return statement.
@@ -163787,7 +163807,7 @@ var ts;
163787
163807
  if (errors) {
163788
163808
  return { errors: errors };
163789
163809
  }
163790
- return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; // TODO: GH#18217
163810
+ return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, thisNode: thisNode } }; // TODO: GH#18217
163791
163811
  /**
163792
163812
  * Attempt to refine the extraction node (generally, by shrinking it) to produce better results.
163793
163813
  * @param node The unrefined extraction node.
@@ -163799,10 +163819,10 @@ var ts;
163799
163819
  }
163800
163820
  }
163801
163821
  else if (ts.isVariableStatement(node) || ts.isVariableDeclarationList(node)) {
163802
- var declarations_6 = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations;
163822
+ var declarations = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations;
163803
163823
  var numInitializers = 0;
163804
163824
  var lastInitializer = void 0;
163805
- for (var _i = 0, declarations_5 = declarations_6; _i < declarations_5.length; _i++) {
163825
+ for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
163806
163826
  var declaration = declarations_5[_i];
163807
163827
  if (declaration.initializer) {
163808
163828
  numInitializers++;
@@ -163902,7 +163922,6 @@ var ts;
163902
163922
  (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity));
163903
163923
  return true;
163904
163924
  }
163905
- declarations.push(node.symbol);
163906
163925
  }
163907
163926
  // Some things can't be extracted in certain situations
163908
163927
  switch (node.kind) {
@@ -167948,8 +167967,8 @@ var ts;
167948
167967
  tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true);
167949
167968
  }
167950
167969
  };
167951
- for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
167952
- var declaration = declarations_7[_i];
167970
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
167971
+ var declaration = declarations_6[_i];
167953
167972
  _loop_20(declaration);
167954
167973
  }
167955
167974
  }
@@ -167975,8 +167994,8 @@ var ts;
167975
167994
  if (inheritedDocs)
167976
167995
  doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc);
167977
167996
  };
167978
- for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
167979
- var declaration = declarations_8[_i];
167997
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
167998
+ var declaration = declarations_7[_i];
167980
167999
  _loop_21(declaration);
167981
168000
  }
167982
168001
  }
@@ -180730,6 +180749,7 @@ var ts;
180730
180749
  var references = getReferencesWorker(projects, this.getDefaultProject(args), { fileName: args.file, pos: position }, this.logger);
180731
180750
  if (!simplifiedResult)
180732
180751
  return references;
180752
+ var preferences = this.getPreferences(file);
180733
180753
  var defaultProject = this.getDefaultProject(args);
180734
180754
  var scriptInfo = defaultProject.getScriptInfoForNormalizedPath(file);
180735
180755
  var nameInfo = defaultProject.getLanguageService().getQuickInfoAtPosition(file, position);
@@ -180738,7 +180758,7 @@ var ts;
180738
180758
  var symbolStartOffset = nameSpan ? scriptInfo.positionToLineOffset(nameSpan.start).offset : 0;
180739
180759
  var symbolName = nameSpan ? scriptInfo.getSnapshot().getText(nameSpan.start, ts.textSpanEnd(nameSpan)) : "";
180740
180760
  var refs = ts.flatMap(references, function (referencedSymbol) {
180741
- return referencedSymbol.references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry); });
180761
+ return referencedSymbol.references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry, preferences); });
180742
180762
  });
180743
180763
  return { refs: refs, symbolName: symbolName, symbolStartOffset: symbolStartOffset, symbolDisplayString: symbolDisplayString };
180744
180764
  };
@@ -180746,6 +180766,7 @@ var ts;
180746
180766
  var _this = this;
180747
180767
  var projects = this.getProjects(args);
180748
180768
  var fileName = args.file;
180769
+ var preferences = this.getPreferences(server.toNormalizedPath(fileName));
180749
180770
  var references = [];
180750
180771
  var seen = createDocumentSpanSet();
180751
180772
  forEachProjectInProjects(projects, /*path*/ undefined, function (project) {
@@ -180764,7 +180785,7 @@ var ts;
180764
180785
  });
180765
180786
  if (!simplifiedResult)
180766
180787
  return references;
180767
- var refs = references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry); });
180788
+ var refs = references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry, preferences); });
180768
180789
  return {
180769
180790
  refs: refs,
180770
180791
  symbolName: "\"".concat(args.file, "\"")
@@ -181828,14 +181849,18 @@ var ts;
181828
181849
  }
181829
181850
  return text;
181830
181851
  }
181831
- function referenceEntryToReferencesResponseItem(projectService, _a) {
181852
+ function referenceEntryToReferencesResponseItem(projectService, _a, _b) {
181832
181853
  var fileName = _a.fileName, textSpan = _a.textSpan, contextSpan = _a.contextSpan, isWriteAccess = _a.isWriteAccess, isDefinition = _a.isDefinition;
181854
+ var disableLineTextInReferences = _b.disableLineTextInReferences;
181833
181855
  var scriptInfo = ts.Debug.checkDefined(projectService.getScriptInfo(fileName));
181834
181856
  var span = toProtocolTextSpanWithContext(textSpan, contextSpan, scriptInfo);
181835
- var lineSpan = scriptInfo.lineToTextSpan(span.start.line - 1);
181836
- var lineText = scriptInfo.getSnapshot().getText(lineSpan.start, ts.textSpanEnd(lineSpan)).replace(/\r|\n/g, "");
181857
+ var lineText = disableLineTextInReferences ? undefined : getLineText(scriptInfo, span);
181837
181858
  return __assign(__assign({ file: fileName }, span), { lineText: lineText, isWriteAccess: isWriteAccess, isDefinition: isDefinition });
181838
181859
  }
181860
+ function getLineText(scriptInfo, span) {
181861
+ var lineSpan = scriptInfo.lineToTextSpan(span.start.line - 1);
181862
+ return scriptInfo.getSnapshot().getText(lineSpan.start, ts.textSpanEnd(lineSpan)).replace(/\r|\n/g, "");
181863
+ }
181839
181864
  function isCompletionEntryData(data) {
181840
181865
  return data === undefined || data && typeof data === "object"
181841
181866
  && typeof data.exportName === "string"
@@ -185875,6 +185900,9 @@ var ts;
185875
185900
  process.on("message", function (e) {
185876
185901
  _this.onMessage(e);
185877
185902
  });
185903
+ process.on("disconnect", function () {
185904
+ _this.exit();
185905
+ });
185878
185906
  };
185879
185907
  return IpcIOSession;
185880
185908
  }(IOSession));
@@ -7982,12 +7982,14 @@ declare namespace ts.server.protocol {
7982
7982
  command: CommandTypes.References;
7983
7983
  }
7984
7984
  interface ReferencesResponseItem extends FileSpanWithContext {
7985
- /** Text of line containing the reference. Including this
7986
- * with the response avoids latency of editor loading files
7987
- * to show text of reference line (the server already has
7988
- * loaded the referencing files).
7985
+ /**
7986
+ * Text of line containing the reference. Including this
7987
+ * with the response avoids latency of editor loading files
7988
+ * to show text of reference line (the server already has loaded the referencing files).
7989
+ *
7990
+ * If {@link UserPreferences.disableLineTextInReferences} is enabled, the property won't be filled
7989
7991
  */
7990
- lineText: string;
7992
+ lineText?: string;
7991
7993
  /**
7992
7994
  * True if reference is a write location, false otherwise.
7993
7995
  */
@@ -9833,6 +9835,10 @@ declare namespace ts.server.protocol {
9833
9835
  readonly includeInlayFunctionLikeReturnTypeHints?: boolean;
9834
9836
  readonly includeInlayEnumMemberValueHints?: boolean;
9835
9837
  readonly autoImportFileExcludePatterns?: string[];
9838
+ /**
9839
+ * Indicates whether {@link ReferencesResponseItem.lineText} is supported.
9840
+ */
9841
+ readonly disableLineTextInReferences?: boolean;
9836
9842
  }
9837
9843
  interface CompilerOptions {
9838
9844
  allowJs?: boolean;
@@ -108,7 +108,7 @@ var ts;
108
108
  // The following is baselined as a literal template type without intervention
109
109
  /** The version of the TypeScript compiler release */
110
110
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
111
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221007");
111
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221012");
112
112
  /* @internal */
113
113
  var Comparison;
114
114
  (function (Comparison) {
@@ -59872,7 +59872,20 @@ var ts;
59872
59872
  return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(type) & 4 /* MappedTypeModifiers.IncludeOptional */);
59873
59873
  }
59874
59874
  function isGenericMappedType(type) {
59875
- return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) && isGenericIndexType(getConstraintTypeFromMappedType(type));
59875
+ if (ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) {
59876
+ var constraint = getConstraintTypeFromMappedType(type);
59877
+ if (isGenericIndexType(constraint)) {
59878
+ return true;
59879
+ }
59880
+ // A mapped type is generic if the 'as' clause references generic types other than the iteration type.
59881
+ // To determine this, we substitute the constraint type (that we now know isn't generic) for the iteration
59882
+ // type and check whether the resulting type is generic.
59883
+ var nameType = getNameTypeFromMappedType(type);
59884
+ if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) {
59885
+ return true;
59886
+ }
59887
+ }
59888
+ return false;
59876
59889
  }
59877
59890
  function resolveStructuredTypeMembers(type) {
59878
59891
  if (!type.members) {
@@ -63192,8 +63205,14 @@ var ts;
63192
63205
  return getStringLiteralType(text);
63193
63206
  }
63194
63207
  newTexts.push(text);
63195
- if (ts.every(newTexts, function (t) { return t === ""; }) && ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) {
63196
- return stringType;
63208
+ if (ts.every(newTexts, function (t) { return t === ""; })) {
63209
+ if (ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) {
63210
+ return stringType;
63211
+ }
63212
+ // Normalize `${Mapping<xxx>}` into Mapping<xxx>
63213
+ if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) {
63214
+ return newTypes[0];
63215
+ }
63197
63216
  }
63198
63217
  var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join(""));
63199
63218
  var type = templateLiteralTypes.get(id);
@@ -63252,12 +63271,14 @@ var ts;
63252
63271
  }
63253
63272
  function getStringMappingType(symbol, type) {
63254
63273
  return type.flags & (1048576 /* TypeFlags.Union */ | 131072 /* TypeFlags.Never */) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) :
63255
- // Mapping<Mapping<T>> === Mapping<T>
63256
- type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type :
63257
- isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456 /* TypeFlags.StringMapping */) ? getTemplateLiteralType(["", ""], [type]) : type) :
63258
- type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
63259
- type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
63260
- type;
63274
+ type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
63275
+ type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
63276
+ // Mapping<Mapping<T>> === Mapping<T>
63277
+ type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type :
63278
+ type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ || type.flags & 268435456 /* TypeFlags.StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) :
63279
+ // This handles Mapping<`${number}`> and Mapping<`${bigint}`>
63280
+ isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) :
63281
+ type;
63261
63282
  }
63262
63283
  function applyStringMapping(symbol, str) {
63263
63284
  switch (intrinsicTypeKinds.get(symbol.escapedName)) {
@@ -63536,10 +63557,11 @@ var ts;
63536
63557
  accessNode;
63537
63558
  }
63538
63559
  function isPatternLiteralPlaceholderType(type) {
63539
- return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || !!(type.flags & 268435456 /* TypeFlags.StringMapping */ && isPatternLiteralPlaceholderType(type.type));
63560
+ return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || isPatternLiteralType(type);
63540
63561
  }
63541
63562
  function isPatternLiteralType(type) {
63542
- return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType);
63563
+ return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType) ||
63564
+ !!(type.flags & 268435456 /* TypeFlags.StringMapping */) && isPatternLiteralPlaceholderType(type.type);
63543
63565
  }
63544
63566
  function isGenericType(type) {
63545
63567
  return !!getGenericObjectFlags(type);
@@ -69726,7 +69748,7 @@ var ts;
69726
69748
  && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
69727
69749
  }
69728
69750
  function isMemberOfStringMapping(source, target) {
69729
- if (target.flags & (4 /* TypeFlags.String */ | 3 /* TypeFlags.AnyOrUnknown */)) {
69751
+ if (target.flags & (4 /* TypeFlags.String */ | 1 /* TypeFlags.Any */)) {
69730
69752
  return true;
69731
69753
  }
69732
69754
  if (target.flags & 134217728 /* TypeFlags.TemplateLiteral */) {
@@ -146632,8 +146654,8 @@ var ts;
146632
146654
  }
146633
146655
  if (ts.scanner.getToken() === 15 /* SyntaxKind.TemplateHead */) {
146634
146656
  var stack = [ts.scanner.getToken()];
146635
- var token = ts.scanner.scan();
146636
146657
  loop: while (ts.length(stack)) {
146658
+ var token = ts.scanner.scan();
146637
146659
  switch (token) {
146638
146660
  case 1 /* SyntaxKind.EndOfFileToken */:
146639
146661
  break loop;
@@ -146661,7 +146683,6 @@ var ts;
146661
146683
  }
146662
146684
  break;
146663
146685
  }
146664
- token = ts.scanner.scan();
146665
146686
  }
146666
146687
  nextToken();
146667
146688
  }
@@ -149140,7 +149161,7 @@ var ts;
149140
149161
  tags = signature.getJsDocTags();
149141
149162
  if (allSignatures.length > 1 && documentation.length === 0 && tags.length === 0) {
149142
149163
  documentation = allSignatures[0].getDocumentationComment(typeChecker);
149143
- tags = allSignatures[0].getJsDocTags();
149164
+ tags = allSignatures[0].getJsDocTags().filter(function (tag) { return tag.name !== "deprecated"; }); // should only include @deprecated JSDoc tag on the first overload (#49368)
149144
149165
  }
149145
149166
  }
149146
149167
  function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) {
@@ -164150,7 +164171,6 @@ var ts;
164150
164171
  var start = cursorRequest ? getExtractableParent(startToken) : ts.getParentNodeInSpan(startToken, sourceFile, adjustedSpan);
164151
164172
  // Do the same for the ending position
164152
164173
  var end = cursorRequest ? start : ts.getParentNodeInSpan(endToken, sourceFile, adjustedSpan);
164153
- var declarations = [];
164154
164174
  // We'll modify these flags as we walk the tree to collect data
164155
164175
  // about what things need to be done as part of the extraction.
164156
164176
  var rangeFacts = RangeFacts.None;
@@ -164193,7 +164213,7 @@ var ts;
164193
164213
  // the expression.
164194
164214
  return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
164195
164215
  }
164196
- return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations, thisNode: thisNode } };
164216
+ return { targetRange: { range: statements, facts: rangeFacts, thisNode: thisNode } };
164197
164217
  }
164198
164218
  if (ts.isReturnStatement(start) && !start.expression) {
164199
164219
  // Makes no sense to extract an expression-less return statement.
@@ -164205,7 +164225,7 @@ var ts;
164205
164225
  if (errors) {
164206
164226
  return { errors: errors };
164207
164227
  }
164208
- return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; // TODO: GH#18217
164228
+ return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, thisNode: thisNode } }; // TODO: GH#18217
164209
164229
  /**
164210
164230
  * Attempt to refine the extraction node (generally, by shrinking it) to produce better results.
164211
164231
  * @param node The unrefined extraction node.
@@ -164217,10 +164237,10 @@ var ts;
164217
164237
  }
164218
164238
  }
164219
164239
  else if (ts.isVariableStatement(node) || ts.isVariableDeclarationList(node)) {
164220
- var declarations_6 = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations;
164240
+ var declarations = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations;
164221
164241
  var numInitializers = 0;
164222
164242
  var lastInitializer = void 0;
164223
- for (var _i = 0, declarations_5 = declarations_6; _i < declarations_5.length; _i++) {
164243
+ for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
164224
164244
  var declaration = declarations_5[_i];
164225
164245
  if (declaration.initializer) {
164226
164246
  numInitializers++;
@@ -164320,7 +164340,6 @@ var ts;
164320
164340
  (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity));
164321
164341
  return true;
164322
164342
  }
164323
- declarations.push(node.symbol);
164324
164343
  }
164325
164344
  // Some things can't be extracted in certain situations
164326
164345
  switch (node.kind) {
@@ -168366,8 +168385,8 @@ var ts;
168366
168385
  tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true);
168367
168386
  }
168368
168387
  };
168369
- for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
168370
- var declaration = declarations_7[_i];
168388
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
168389
+ var declaration = declarations_6[_i];
168371
168390
  _loop_20(declaration);
168372
168391
  }
168373
168392
  }
@@ -168393,8 +168412,8 @@ var ts;
168393
168412
  if (inheritedDocs)
168394
168413
  doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc);
168395
168414
  };
168396
- for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
168397
- var declaration = declarations_8[_i];
168415
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
168416
+ var declaration = declarations_7[_i];
168398
168417
  _loop_21(declaration);
168399
168418
  }
168400
168419
  }
@@ -180729,6 +180748,7 @@ var ts;
180729
180748
  var references = getReferencesWorker(projects, this.getDefaultProject(args), { fileName: args.file, pos: position }, this.logger);
180730
180749
  if (!simplifiedResult)
180731
180750
  return references;
180751
+ var preferences = this.getPreferences(file);
180732
180752
  var defaultProject = this.getDefaultProject(args);
180733
180753
  var scriptInfo = defaultProject.getScriptInfoForNormalizedPath(file);
180734
180754
  var nameInfo = defaultProject.getLanguageService().getQuickInfoAtPosition(file, position);
@@ -180737,7 +180757,7 @@ var ts;
180737
180757
  var symbolStartOffset = nameSpan ? scriptInfo.positionToLineOffset(nameSpan.start).offset : 0;
180738
180758
  var symbolName = nameSpan ? scriptInfo.getSnapshot().getText(nameSpan.start, ts.textSpanEnd(nameSpan)) : "";
180739
180759
  var refs = ts.flatMap(references, function (referencedSymbol) {
180740
- return referencedSymbol.references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry); });
180760
+ return referencedSymbol.references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry, preferences); });
180741
180761
  });
180742
180762
  return { refs: refs, symbolName: symbolName, symbolStartOffset: symbolStartOffset, symbolDisplayString: symbolDisplayString };
180743
180763
  };
@@ -180745,6 +180765,7 @@ var ts;
180745
180765
  var _this = this;
180746
180766
  var projects = this.getProjects(args);
180747
180767
  var fileName = args.file;
180768
+ var preferences = this.getPreferences(server.toNormalizedPath(fileName));
180748
180769
  var references = [];
180749
180770
  var seen = createDocumentSpanSet();
180750
180771
  forEachProjectInProjects(projects, /*path*/ undefined, function (project) {
@@ -180763,7 +180784,7 @@ var ts;
180763
180784
  });
180764
180785
  if (!simplifiedResult)
180765
180786
  return references;
180766
- var refs = references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry); });
180787
+ var refs = references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry, preferences); });
180767
180788
  return {
180768
180789
  refs: refs,
180769
180790
  symbolName: "\"".concat(args.file, "\"")
@@ -181827,14 +181848,18 @@ var ts;
181827
181848
  }
181828
181849
  return text;
181829
181850
  }
181830
- function referenceEntryToReferencesResponseItem(projectService, _a) {
181851
+ function referenceEntryToReferencesResponseItem(projectService, _a, _b) {
181831
181852
  var fileName = _a.fileName, textSpan = _a.textSpan, contextSpan = _a.contextSpan, isWriteAccess = _a.isWriteAccess, isDefinition = _a.isDefinition;
181853
+ var disableLineTextInReferences = _b.disableLineTextInReferences;
181832
181854
  var scriptInfo = ts.Debug.checkDefined(projectService.getScriptInfo(fileName));
181833
181855
  var span = toProtocolTextSpanWithContext(textSpan, contextSpan, scriptInfo);
181834
- var lineSpan = scriptInfo.lineToTextSpan(span.start.line - 1);
181835
- var lineText = scriptInfo.getSnapshot().getText(lineSpan.start, ts.textSpanEnd(lineSpan)).replace(/\r|\n/g, "");
181856
+ var lineText = disableLineTextInReferences ? undefined : getLineText(scriptInfo, span);
181836
181857
  return __assign(__assign({ file: fileName }, span), { lineText: lineText, isWriteAccess: isWriteAccess, isDefinition: isDefinition });
181837
181858
  }
181859
+ function getLineText(scriptInfo, span) {
181860
+ var lineSpan = scriptInfo.lineToTextSpan(span.start.line - 1);
181861
+ return scriptInfo.getSnapshot().getText(lineSpan.start, ts.textSpanEnd(lineSpan)).replace(/\r|\n/g, "");
181862
+ }
181838
181863
  function isCompletionEntryData(data) {
181839
181864
  return data === undefined || data && typeof data === "object"
181840
181865
  && typeof data.exportName === "string"
package/lib/typescript.js CHANGED
@@ -99,7 +99,7 @@ var ts;
99
99
  // The following is baselined as a literal template type without intervention
100
100
  /** The version of the TypeScript compiler release */
101
101
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
102
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221007");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221012");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -59863,7 +59863,20 @@ var ts;
59863
59863
  return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(type) & 4 /* MappedTypeModifiers.IncludeOptional */);
59864
59864
  }
59865
59865
  function isGenericMappedType(type) {
59866
- return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) && isGenericIndexType(getConstraintTypeFromMappedType(type));
59866
+ if (ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) {
59867
+ var constraint = getConstraintTypeFromMappedType(type);
59868
+ if (isGenericIndexType(constraint)) {
59869
+ return true;
59870
+ }
59871
+ // A mapped type is generic if the 'as' clause references generic types other than the iteration type.
59872
+ // To determine this, we substitute the constraint type (that we now know isn't generic) for the iteration
59873
+ // type and check whether the resulting type is generic.
59874
+ var nameType = getNameTypeFromMappedType(type);
59875
+ if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) {
59876
+ return true;
59877
+ }
59878
+ }
59879
+ return false;
59867
59880
  }
59868
59881
  function resolveStructuredTypeMembers(type) {
59869
59882
  if (!type.members) {
@@ -63183,8 +63196,14 @@ var ts;
63183
63196
  return getStringLiteralType(text);
63184
63197
  }
63185
63198
  newTexts.push(text);
63186
- if (ts.every(newTexts, function (t) { return t === ""; }) && ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) {
63187
- return stringType;
63199
+ if (ts.every(newTexts, function (t) { return t === ""; })) {
63200
+ if (ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) {
63201
+ return stringType;
63202
+ }
63203
+ // Normalize `${Mapping<xxx>}` into Mapping<xxx>
63204
+ if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) {
63205
+ return newTypes[0];
63206
+ }
63188
63207
  }
63189
63208
  var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join(""));
63190
63209
  var type = templateLiteralTypes.get(id);
@@ -63243,12 +63262,14 @@ var ts;
63243
63262
  }
63244
63263
  function getStringMappingType(symbol, type) {
63245
63264
  return type.flags & (1048576 /* TypeFlags.Union */ | 131072 /* TypeFlags.Never */) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) :
63246
- // Mapping<Mapping<T>> === Mapping<T>
63247
- type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type :
63248
- isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456 /* TypeFlags.StringMapping */) ? getTemplateLiteralType(["", ""], [type]) : type) :
63249
- type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
63250
- type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
63251
- type;
63265
+ type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
63266
+ type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
63267
+ // Mapping<Mapping<T>> === Mapping<T>
63268
+ type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type :
63269
+ type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ || type.flags & 268435456 /* TypeFlags.StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) :
63270
+ // This handles Mapping<`${number}`> and Mapping<`${bigint}`>
63271
+ isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) :
63272
+ type;
63252
63273
  }
63253
63274
  function applyStringMapping(symbol, str) {
63254
63275
  switch (intrinsicTypeKinds.get(symbol.escapedName)) {
@@ -63527,10 +63548,11 @@ var ts;
63527
63548
  accessNode;
63528
63549
  }
63529
63550
  function isPatternLiteralPlaceholderType(type) {
63530
- return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || !!(type.flags & 268435456 /* TypeFlags.StringMapping */ && isPatternLiteralPlaceholderType(type.type));
63551
+ return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || isPatternLiteralType(type);
63531
63552
  }
63532
63553
  function isPatternLiteralType(type) {
63533
- return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType);
63554
+ return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType) ||
63555
+ !!(type.flags & 268435456 /* TypeFlags.StringMapping */) && isPatternLiteralPlaceholderType(type.type);
63534
63556
  }
63535
63557
  function isGenericType(type) {
63536
63558
  return !!getGenericObjectFlags(type);
@@ -69717,7 +69739,7 @@ var ts;
69717
69739
  && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
69718
69740
  }
69719
69741
  function isMemberOfStringMapping(source, target) {
69720
- if (target.flags & (4 /* TypeFlags.String */ | 3 /* TypeFlags.AnyOrUnknown */)) {
69742
+ if (target.flags & (4 /* TypeFlags.String */ | 1 /* TypeFlags.Any */)) {
69721
69743
  return true;
69722
69744
  }
69723
69745
  if (target.flags & 134217728 /* TypeFlags.TemplateLiteral */) {
@@ -146623,8 +146645,8 @@ var ts;
146623
146645
  }
146624
146646
  if (ts.scanner.getToken() === 15 /* SyntaxKind.TemplateHead */) {
146625
146647
  var stack = [ts.scanner.getToken()];
146626
- var token = ts.scanner.scan();
146627
146648
  loop: while (ts.length(stack)) {
146649
+ var token = ts.scanner.scan();
146628
146650
  switch (token) {
146629
146651
  case 1 /* SyntaxKind.EndOfFileToken */:
146630
146652
  break loop;
@@ -146652,7 +146674,6 @@ var ts;
146652
146674
  }
146653
146675
  break;
146654
146676
  }
146655
- token = ts.scanner.scan();
146656
146677
  }
146657
146678
  nextToken();
146658
146679
  }
@@ -149131,7 +149152,7 @@ var ts;
149131
149152
  tags = signature.getJsDocTags();
149132
149153
  if (allSignatures.length > 1 && documentation.length === 0 && tags.length === 0) {
149133
149154
  documentation = allSignatures[0].getDocumentationComment(typeChecker);
149134
- tags = allSignatures[0].getJsDocTags();
149155
+ tags = allSignatures[0].getJsDocTags().filter(function (tag) { return tag.name !== "deprecated"; }); // should only include @deprecated JSDoc tag on the first overload (#49368)
149135
149156
  }
149136
149157
  }
149137
149158
  function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) {
@@ -164141,7 +164162,6 @@ var ts;
164141
164162
  var start = cursorRequest ? getExtractableParent(startToken) : ts.getParentNodeInSpan(startToken, sourceFile, adjustedSpan);
164142
164163
  // Do the same for the ending position
164143
164164
  var end = cursorRequest ? start : ts.getParentNodeInSpan(endToken, sourceFile, adjustedSpan);
164144
- var declarations = [];
164145
164165
  // We'll modify these flags as we walk the tree to collect data
164146
164166
  // about what things need to be done as part of the extraction.
164147
164167
  var rangeFacts = RangeFacts.None;
@@ -164184,7 +164204,7 @@ var ts;
164184
164204
  // the expression.
164185
164205
  return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
164186
164206
  }
164187
- return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations, thisNode: thisNode } };
164207
+ return { targetRange: { range: statements, facts: rangeFacts, thisNode: thisNode } };
164188
164208
  }
164189
164209
  if (ts.isReturnStatement(start) && !start.expression) {
164190
164210
  // Makes no sense to extract an expression-less return statement.
@@ -164196,7 +164216,7 @@ var ts;
164196
164216
  if (errors) {
164197
164217
  return { errors: errors };
164198
164218
  }
164199
- return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; // TODO: GH#18217
164219
+ return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, thisNode: thisNode } }; // TODO: GH#18217
164200
164220
  /**
164201
164221
  * Attempt to refine the extraction node (generally, by shrinking it) to produce better results.
164202
164222
  * @param node The unrefined extraction node.
@@ -164208,10 +164228,10 @@ var ts;
164208
164228
  }
164209
164229
  }
164210
164230
  else if (ts.isVariableStatement(node) || ts.isVariableDeclarationList(node)) {
164211
- var declarations_6 = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations;
164231
+ var declarations = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations;
164212
164232
  var numInitializers = 0;
164213
164233
  var lastInitializer = void 0;
164214
- for (var _i = 0, declarations_5 = declarations_6; _i < declarations_5.length; _i++) {
164234
+ for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
164215
164235
  var declaration = declarations_5[_i];
164216
164236
  if (declaration.initializer) {
164217
164237
  numInitializers++;
@@ -164311,7 +164331,6 @@ var ts;
164311
164331
  (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity));
164312
164332
  return true;
164313
164333
  }
164314
- declarations.push(node.symbol);
164315
164334
  }
164316
164335
  // Some things can't be extracted in certain situations
164317
164336
  switch (node.kind) {
@@ -168357,8 +168376,8 @@ var ts;
168357
168376
  tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true);
168358
168377
  }
168359
168378
  };
168360
- for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
168361
- var declaration = declarations_7[_i];
168379
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
168380
+ var declaration = declarations_6[_i];
168362
168381
  _loop_20(declaration);
168363
168382
  }
168364
168383
  }
@@ -168384,8 +168403,8 @@ var ts;
168384
168403
  if (inheritedDocs)
168385
168404
  doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc);
168386
168405
  };
168387
- for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
168388
- var declaration = declarations_8[_i];
168406
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
168407
+ var declaration = declarations_7[_i];
168389
168408
  _loop_21(declaration);
168390
168409
  }
168391
168410
  }
@@ -99,7 +99,7 @@ var ts;
99
99
  // The following is baselined as a literal template type without intervention
100
100
  /** The version of the TypeScript compiler release */
101
101
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
102
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221007");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221012");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -59863,7 +59863,20 @@ var ts;
59863
59863
  return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(type) & 4 /* MappedTypeModifiers.IncludeOptional */);
59864
59864
  }
59865
59865
  function isGenericMappedType(type) {
59866
- return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) && isGenericIndexType(getConstraintTypeFromMappedType(type));
59866
+ if (ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) {
59867
+ var constraint = getConstraintTypeFromMappedType(type);
59868
+ if (isGenericIndexType(constraint)) {
59869
+ return true;
59870
+ }
59871
+ // A mapped type is generic if the 'as' clause references generic types other than the iteration type.
59872
+ // To determine this, we substitute the constraint type (that we now know isn't generic) for the iteration
59873
+ // type and check whether the resulting type is generic.
59874
+ var nameType = getNameTypeFromMappedType(type);
59875
+ if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) {
59876
+ return true;
59877
+ }
59878
+ }
59879
+ return false;
59867
59880
  }
59868
59881
  function resolveStructuredTypeMembers(type) {
59869
59882
  if (!type.members) {
@@ -63183,8 +63196,14 @@ var ts;
63183
63196
  return getStringLiteralType(text);
63184
63197
  }
63185
63198
  newTexts.push(text);
63186
- if (ts.every(newTexts, function (t) { return t === ""; }) && ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) {
63187
- return stringType;
63199
+ if (ts.every(newTexts, function (t) { return t === ""; })) {
63200
+ if (ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) {
63201
+ return stringType;
63202
+ }
63203
+ // Normalize `${Mapping<xxx>}` into Mapping<xxx>
63204
+ if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) {
63205
+ return newTypes[0];
63206
+ }
63188
63207
  }
63189
63208
  var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join(""));
63190
63209
  var type = templateLiteralTypes.get(id);
@@ -63243,12 +63262,14 @@ var ts;
63243
63262
  }
63244
63263
  function getStringMappingType(symbol, type) {
63245
63264
  return type.flags & (1048576 /* TypeFlags.Union */ | 131072 /* TypeFlags.Never */) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) :
63246
- // Mapping<Mapping<T>> === Mapping<T>
63247
- type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type :
63248
- isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456 /* TypeFlags.StringMapping */) ? getTemplateLiteralType(["", ""], [type]) : type) :
63249
- type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
63250
- type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
63251
- type;
63265
+ type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
63266
+ type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
63267
+ // Mapping<Mapping<T>> === Mapping<T>
63268
+ type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type :
63269
+ type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ || type.flags & 268435456 /* TypeFlags.StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) :
63270
+ // This handles Mapping<`${number}`> and Mapping<`${bigint}`>
63271
+ isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) :
63272
+ type;
63252
63273
  }
63253
63274
  function applyStringMapping(symbol, str) {
63254
63275
  switch (intrinsicTypeKinds.get(symbol.escapedName)) {
@@ -63527,10 +63548,11 @@ var ts;
63527
63548
  accessNode;
63528
63549
  }
63529
63550
  function isPatternLiteralPlaceholderType(type) {
63530
- return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || !!(type.flags & 268435456 /* TypeFlags.StringMapping */ && isPatternLiteralPlaceholderType(type.type));
63551
+ return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || isPatternLiteralType(type);
63531
63552
  }
63532
63553
  function isPatternLiteralType(type) {
63533
- return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType);
63554
+ return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType) ||
63555
+ !!(type.flags & 268435456 /* TypeFlags.StringMapping */) && isPatternLiteralPlaceholderType(type.type);
63534
63556
  }
63535
63557
  function isGenericType(type) {
63536
63558
  return !!getGenericObjectFlags(type);
@@ -69717,7 +69739,7 @@ var ts;
69717
69739
  && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
69718
69740
  }
69719
69741
  function isMemberOfStringMapping(source, target) {
69720
- if (target.flags & (4 /* TypeFlags.String */ | 3 /* TypeFlags.AnyOrUnknown */)) {
69742
+ if (target.flags & (4 /* TypeFlags.String */ | 1 /* TypeFlags.Any */)) {
69721
69743
  return true;
69722
69744
  }
69723
69745
  if (target.flags & 134217728 /* TypeFlags.TemplateLiteral */) {
@@ -146623,8 +146645,8 @@ var ts;
146623
146645
  }
146624
146646
  if (ts.scanner.getToken() === 15 /* SyntaxKind.TemplateHead */) {
146625
146647
  var stack = [ts.scanner.getToken()];
146626
- var token = ts.scanner.scan();
146627
146648
  loop: while (ts.length(stack)) {
146649
+ var token = ts.scanner.scan();
146628
146650
  switch (token) {
146629
146651
  case 1 /* SyntaxKind.EndOfFileToken */:
146630
146652
  break loop;
@@ -146652,7 +146674,6 @@ var ts;
146652
146674
  }
146653
146675
  break;
146654
146676
  }
146655
- token = ts.scanner.scan();
146656
146677
  }
146657
146678
  nextToken();
146658
146679
  }
@@ -149131,7 +149152,7 @@ var ts;
149131
149152
  tags = signature.getJsDocTags();
149132
149153
  if (allSignatures.length > 1 && documentation.length === 0 && tags.length === 0) {
149133
149154
  documentation = allSignatures[0].getDocumentationComment(typeChecker);
149134
- tags = allSignatures[0].getJsDocTags();
149155
+ tags = allSignatures[0].getJsDocTags().filter(function (tag) { return tag.name !== "deprecated"; }); // should only include @deprecated JSDoc tag on the first overload (#49368)
149135
149156
  }
149136
149157
  }
149137
149158
  function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) {
@@ -164141,7 +164162,6 @@ var ts;
164141
164162
  var start = cursorRequest ? getExtractableParent(startToken) : ts.getParentNodeInSpan(startToken, sourceFile, adjustedSpan);
164142
164163
  // Do the same for the ending position
164143
164164
  var end = cursorRequest ? start : ts.getParentNodeInSpan(endToken, sourceFile, adjustedSpan);
164144
- var declarations = [];
164145
164165
  // We'll modify these flags as we walk the tree to collect data
164146
164166
  // about what things need to be done as part of the extraction.
164147
164167
  var rangeFacts = RangeFacts.None;
@@ -164184,7 +164204,7 @@ var ts;
164184
164204
  // the expression.
164185
164205
  return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
164186
164206
  }
164187
- return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations, thisNode: thisNode } };
164207
+ return { targetRange: { range: statements, facts: rangeFacts, thisNode: thisNode } };
164188
164208
  }
164189
164209
  if (ts.isReturnStatement(start) && !start.expression) {
164190
164210
  // Makes no sense to extract an expression-less return statement.
@@ -164196,7 +164216,7 @@ var ts;
164196
164216
  if (errors) {
164197
164217
  return { errors: errors };
164198
164218
  }
164199
- return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; // TODO: GH#18217
164219
+ return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, thisNode: thisNode } }; // TODO: GH#18217
164200
164220
  /**
164201
164221
  * Attempt to refine the extraction node (generally, by shrinking it) to produce better results.
164202
164222
  * @param node The unrefined extraction node.
@@ -164208,10 +164228,10 @@ var ts;
164208
164228
  }
164209
164229
  }
164210
164230
  else if (ts.isVariableStatement(node) || ts.isVariableDeclarationList(node)) {
164211
- var declarations_6 = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations;
164231
+ var declarations = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations;
164212
164232
  var numInitializers = 0;
164213
164233
  var lastInitializer = void 0;
164214
- for (var _i = 0, declarations_5 = declarations_6; _i < declarations_5.length; _i++) {
164234
+ for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
164215
164235
  var declaration = declarations_5[_i];
164216
164236
  if (declaration.initializer) {
164217
164237
  numInitializers++;
@@ -164311,7 +164331,6 @@ var ts;
164311
164331
  (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity));
164312
164332
  return true;
164313
164333
  }
164314
- declarations.push(node.symbol);
164315
164334
  }
164316
164335
  // Some things can't be extracted in certain situations
164317
164336
  switch (node.kind) {
@@ -168357,8 +168376,8 @@ var ts;
168357
168376
  tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true);
168358
168377
  }
168359
168378
  };
168360
- for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
168361
- var declaration = declarations_7[_i];
168379
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
168380
+ var declaration = declarations_6[_i];
168362
168381
  _loop_20(declaration);
168363
168382
  }
168364
168383
  }
@@ -168384,8 +168403,8 @@ var ts;
168384
168403
  if (inheritedDocs)
168385
168404
  doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc);
168386
168405
  };
168387
- for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
168388
- var declaration = declarations_8[_i];
168406
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
168407
+ var declaration = declarations_7[_i];
168389
168408
  _loop_21(declaration);
168390
168409
  }
168391
168410
  }
@@ -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 = "".concat(ts.versionMajorMinor, ".0-dev.20221007");
92
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221012");
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -59853,7 +59853,20 @@ var ts;
59853
59853
  return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(type) & 4 /* MappedTypeModifiers.IncludeOptional */);
59854
59854
  }
59855
59855
  function isGenericMappedType(type) {
59856
- return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) && isGenericIndexType(getConstraintTypeFromMappedType(type));
59856
+ if (ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) {
59857
+ var constraint = getConstraintTypeFromMappedType(type);
59858
+ if (isGenericIndexType(constraint)) {
59859
+ return true;
59860
+ }
59861
+ // A mapped type is generic if the 'as' clause references generic types other than the iteration type.
59862
+ // To determine this, we substitute the constraint type (that we now know isn't generic) for the iteration
59863
+ // type and check whether the resulting type is generic.
59864
+ var nameType = getNameTypeFromMappedType(type);
59865
+ if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) {
59866
+ return true;
59867
+ }
59868
+ }
59869
+ return false;
59857
59870
  }
59858
59871
  function resolveStructuredTypeMembers(type) {
59859
59872
  if (!type.members) {
@@ -63173,8 +63186,14 @@ var ts;
63173
63186
  return getStringLiteralType(text);
63174
63187
  }
63175
63188
  newTexts.push(text);
63176
- if (ts.every(newTexts, function (t) { return t === ""; }) && ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) {
63177
- return stringType;
63189
+ if (ts.every(newTexts, function (t) { return t === ""; })) {
63190
+ if (ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) {
63191
+ return stringType;
63192
+ }
63193
+ // Normalize `${Mapping<xxx>}` into Mapping<xxx>
63194
+ if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) {
63195
+ return newTypes[0];
63196
+ }
63178
63197
  }
63179
63198
  var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join(""));
63180
63199
  var type = templateLiteralTypes.get(id);
@@ -63233,12 +63252,14 @@ var ts;
63233
63252
  }
63234
63253
  function getStringMappingType(symbol, type) {
63235
63254
  return type.flags & (1048576 /* TypeFlags.Union */ | 131072 /* TypeFlags.Never */) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) :
63236
- // Mapping<Mapping<T>> === Mapping<T>
63237
- type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type :
63238
- isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456 /* TypeFlags.StringMapping */) ? getTemplateLiteralType(["", ""], [type]) : type) :
63239
- type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
63240
- type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
63241
- type;
63255
+ type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
63256
+ type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
63257
+ // Mapping<Mapping<T>> === Mapping<T>
63258
+ type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type :
63259
+ type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ || type.flags & 268435456 /* TypeFlags.StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) :
63260
+ // This handles Mapping<`${number}`> and Mapping<`${bigint}`>
63261
+ isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) :
63262
+ type;
63242
63263
  }
63243
63264
  function applyStringMapping(symbol, str) {
63244
63265
  switch (intrinsicTypeKinds.get(symbol.escapedName)) {
@@ -63517,10 +63538,11 @@ var ts;
63517
63538
  accessNode;
63518
63539
  }
63519
63540
  function isPatternLiteralPlaceholderType(type) {
63520
- return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || !!(type.flags & 268435456 /* TypeFlags.StringMapping */ && isPatternLiteralPlaceholderType(type.type));
63541
+ return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || isPatternLiteralType(type);
63521
63542
  }
63522
63543
  function isPatternLiteralType(type) {
63523
- return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType);
63544
+ return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType) ||
63545
+ !!(type.flags & 268435456 /* TypeFlags.StringMapping */) && isPatternLiteralPlaceholderType(type.type);
63524
63546
  }
63525
63547
  function isGenericType(type) {
63526
63548
  return !!getGenericObjectFlags(type);
@@ -69707,7 +69729,7 @@ var ts;
69707
69729
  && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
69708
69730
  }
69709
69731
  function isMemberOfStringMapping(source, target) {
69710
- if (target.flags & (4 /* TypeFlags.String */ | 3 /* TypeFlags.AnyOrUnknown */)) {
69732
+ if (target.flags & (4 /* TypeFlags.String */ | 1 /* TypeFlags.Any */)) {
69711
69733
  return true;
69712
69734
  }
69713
69735
  if (target.flags & 134217728 /* TypeFlags.TemplateLiteral */) {
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.9.0-dev.20221007",
5
+ "version": "4.9.0-dev.20221012",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -41,6 +41,7 @@
41
41
  "devDependencies": {
42
42
  "@octokit/rest": "latest",
43
43
  "@types/chai": "latest",
44
+ "@types/fancy-log": "^2.0.0",
44
45
  "@types/fs-extra": "^9.0.13",
45
46
  "@types/glob": "latest",
46
47
  "@types/gulp": "^4.0.9",
@@ -55,8 +56,8 @@
55
56
  "@types/mocha": "latest",
56
57
  "@types/ms": "latest",
57
58
  "@types/node": "latest",
58
- "@types/node-fetch": "^2.6.2",
59
59
  "@types/source-map-support": "latest",
60
+ "@types/which": "^2.0.1",
60
61
  "@types/xml2js": "^0.4.11",
61
62
  "@typescript-eslint/eslint-plugin": "^5.33.1",
62
63
  "@typescript-eslint/parser": "^5.33.1",
@@ -87,7 +88,7 @@
87
88
  "mocha": "latest",
88
89
  "mocha-fivemat-progress-reporter": "latest",
89
90
  "ms": "^2.1.3",
90
- "node-fetch": "^2.6.7",
91
+ "node-fetch": "^3.2.10",
91
92
  "source-map-support": "latest",
92
93
  "typescript": "^4.8.4",
93
94
  "vinyl": "latest",
@@ -107,7 +108,7 @@
107
108
  "clean": "gulp clean",
108
109
  "gulp": "gulp",
109
110
  "lint": "gulp lint",
110
- "setup-hooks": "node scripts/link-hooks.js"
111
+ "setup-hooks": "node scripts/link-hooks.mjs"
111
112
  },
112
113
  "browser": {
113
114
  "fs": false,