typescript 4.8.0-dev.20220711 → 4.8.0-dev.20220714

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.8";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20220711";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220714";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -2699,6 +2699,32 @@ var ts;
2699
2699
  return result;
2700
2700
  }
2701
2701
  Debug.formatVariance = formatVariance;
2702
+ var DebugTypeMapper = (function () {
2703
+ function DebugTypeMapper() {
2704
+ }
2705
+ DebugTypeMapper.prototype.__debugToString = function () {
2706
+ var _a;
2707
+ type(this);
2708
+ switch (this.kind) {
2709
+ case 3: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
2710
+ case 0: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
2711
+ case 1: return ts.zipWith(this.sources, this.targets || ts.map(this.sources, function () { return "any"; }), function (s, t) { return s.__debugTypeToString() + " -> " + (typeof t === "string" ? t : t.__debugTypeToString()); }).join(", ");
2712
+ case 2: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
2713
+ case 5:
2714
+ case 4: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
2715
+ default: return assertNever(this);
2716
+ }
2717
+ };
2718
+ return DebugTypeMapper;
2719
+ }());
2720
+ Debug.DebugTypeMapper = DebugTypeMapper;
2721
+ function attachDebugPrototypeIfDebug(mapper) {
2722
+ if (Debug.isDebugging) {
2723
+ return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
2724
+ }
2725
+ return mapper;
2726
+ }
2727
+ Debug.attachDebugPrototypeIfDebug = attachDebugPrototypeIfDebug;
2702
2728
  })(Debug = ts.Debug || (ts.Debug = {}));
2703
2729
  })(ts || (ts = {}));
2704
2730
  var ts;
@@ -39848,24 +39874,6 @@ var ts;
39848
39874
  var Symbol = ts.objectAllocator.getSymbolConstructor();
39849
39875
  var Type = ts.objectAllocator.getTypeConstructor();
39850
39876
  var Signature = ts.objectAllocator.getSignatureConstructor();
39851
- var DebugTypeMapper = (function () {
39852
- function DebugTypeMapper() {
39853
- }
39854
- DebugTypeMapper.prototype.__debugToString = function () {
39855
- var _a;
39856
- ts.Debug.type(this);
39857
- switch (this.kind) {
39858
- case 3: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
39859
- case 0: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
39860
- case 1: return ts.zipWith(this.sources, this.targets || ts.map(this.sources, function () { return anyType; }), function (s, t) { return s.__debugTypeToString() + " -> " + t.__debugTypeToString(); }).join(", ");
39861
- case 2: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
39862
- case 5:
39863
- case 4: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
39864
- default: return ts.Debug.assertNever(this);
39865
- }
39866
- };
39867
- return DebugTypeMapper;
39868
- }());
39869
39877
  var typeCount = 0;
39870
39878
  var symbolCount = 0;
39871
39879
  var enumCount = 0;
@@ -53153,26 +53161,20 @@ var ts;
53153
53161
  return t1 !== type && mapper.kind === 4 ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2);
53154
53162
  }
53155
53163
  }
53156
- function attachDebugPrototypeIfDebug(mapper) {
53157
- if (ts.Debug.isDebugging) {
53158
- return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
53159
- }
53160
- return mapper;
53161
- }
53162
53164
  function makeUnaryTypeMapper(source, target) {
53163
- return attachDebugPrototypeIfDebug({ kind: 0, source: source, target: target });
53165
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 0, source: source, target: target });
53164
53166
  }
53165
53167
  function makeArrayTypeMapper(sources, targets) {
53166
- return attachDebugPrototypeIfDebug({ kind: 1, sources: sources, targets: targets });
53168
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 1, sources: sources, targets: targets });
53167
53169
  }
53168
53170
  function makeFunctionTypeMapper(func, debugInfo) {
53169
- return attachDebugPrototypeIfDebug({ kind: 3, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
53171
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 3, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
53170
53172
  }
53171
53173
  function makeDeferredTypeMapper(sources, targets) {
53172
- return attachDebugPrototypeIfDebug({ kind: 2, sources: sources, targets: targets });
53174
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 2, sources: sources, targets: targets });
53173
53175
  }
53174
53176
  function makeCompositeTypeMapper(kind, mapper1, mapper2) {
53175
- return attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
53177
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
53176
53178
  }
53177
53179
  function createTypeEraser(sources) {
53178
53180
  return createTypeMapper(sources, undefined);
@@ -61285,6 +61287,14 @@ var ts;
61285
61287
  var lhsType = getTypeOfExpression(e.expression);
61286
61288
  return ts.isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText);
61287
61289
  }
61290
+ if (ts.isElementAccessExpression(e)) {
61291
+ var propType = checkExpressionCached(e.argumentExpression);
61292
+ if (!isTypeUsableAsPropertyName(propType)) {
61293
+ return undefined;
61294
+ }
61295
+ var lhsType = getTypeOfExpression(e.expression);
61296
+ return getPropertyOfType(lhsType, getPropertyNameFromType(propType));
61297
+ }
61288
61298
  return undefined;
61289
61299
  function tryGetPrivateIdentifierPropertyOfType(type, id) {
61290
61300
  var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(id.escapedText, id);
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 = ts.versionMajorMinor + ".0-dev.20220711";
112
+ ts.version = ts.versionMajorMinor + ".0-dev.20220714";
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -3156,6 +3156,32 @@ var ts;
3156
3156
  return result;
3157
3157
  }
3158
3158
  Debug.formatVariance = formatVariance;
3159
+ var DebugTypeMapper = /** @class */ (function () {
3160
+ function DebugTypeMapper() {
3161
+ }
3162
+ DebugTypeMapper.prototype.__debugToString = function () {
3163
+ var _a;
3164
+ type(this);
3165
+ switch (this.kind) {
3166
+ case 3 /* Function */: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
3167
+ case 0 /* Simple */: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
3168
+ case 1 /* Array */: return ts.zipWith(this.sources, this.targets || ts.map(this.sources, function () { return "any"; }), function (s, t) { return s.__debugTypeToString() + " -> " + (typeof t === "string" ? t : t.__debugTypeToString()); }).join(", ");
3169
+ case 2 /* Deferred */: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
3170
+ case 5 /* Merged */:
3171
+ case 4 /* Composite */: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
3172
+ default: return assertNever(this);
3173
+ }
3174
+ };
3175
+ return DebugTypeMapper;
3176
+ }());
3177
+ Debug.DebugTypeMapper = DebugTypeMapper;
3178
+ function attachDebugPrototypeIfDebug(mapper) {
3179
+ if (Debug.isDebugging) {
3180
+ return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
3181
+ }
3182
+ return mapper;
3183
+ }
3184
+ Debug.attachDebugPrototypeIfDebug = attachDebugPrototypeIfDebug;
3159
3185
  })(Debug = ts.Debug || (ts.Debug = {}));
3160
3186
  })(ts || (ts = {}));
3161
3187
  /* @internal */
@@ -48707,24 +48733,6 @@ var ts;
48707
48733
  var Symbol = ts.objectAllocator.getSymbolConstructor();
48708
48734
  var Type = ts.objectAllocator.getTypeConstructor();
48709
48735
  var Signature = ts.objectAllocator.getSignatureConstructor();
48710
- var DebugTypeMapper = /** @class */ (function () {
48711
- function DebugTypeMapper() {
48712
- }
48713
- DebugTypeMapper.prototype.__debugToString = function () {
48714
- var _a;
48715
- ts.Debug.type(this);
48716
- switch (this.kind) {
48717
- case 3 /* Function */: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
48718
- case 0 /* Simple */: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
48719
- case 1 /* Array */: return ts.zipWith(this.sources, this.targets || ts.map(this.sources, function () { return anyType; }), function (s, t) { return s.__debugTypeToString() + " -> " + t.__debugTypeToString(); }).join(", ");
48720
- case 2 /* Deferred */: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
48721
- case 5 /* Merged */:
48722
- case 4 /* Composite */: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
48723
- default: return ts.Debug.assertNever(this);
48724
- }
48725
- };
48726
- return DebugTypeMapper;
48727
- }());
48728
48736
  var typeCount = 0;
48729
48737
  var symbolCount = 0;
48730
48738
  var enumCount = 0;
@@ -63854,26 +63862,20 @@ var ts;
63854
63862
  return t1 !== type && mapper.kind === 4 /* Composite */ ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2);
63855
63863
  }
63856
63864
  }
63857
- function attachDebugPrototypeIfDebug(mapper) {
63858
- if (ts.Debug.isDebugging) {
63859
- return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
63860
- }
63861
- return mapper;
63862
- }
63863
63865
  function makeUnaryTypeMapper(source, target) {
63864
- return attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
63866
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
63865
63867
  }
63866
63868
  function makeArrayTypeMapper(sources, targets) {
63867
- return attachDebugPrototypeIfDebug({ kind: 1 /* Array */, sources: sources, targets: targets });
63869
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 1 /* Array */, sources: sources, targets: targets });
63868
63870
  }
63869
63871
  function makeFunctionTypeMapper(func, debugInfo) {
63870
- return attachDebugPrototypeIfDebug({ kind: 3 /* Function */, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
63872
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 3 /* Function */, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
63871
63873
  }
63872
63874
  function makeDeferredTypeMapper(sources, targets) {
63873
- return attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
63875
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
63874
63876
  }
63875
63877
  function makeCompositeTypeMapper(kind, mapper1, mapper2) {
63876
- return attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
63878
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
63877
63879
  }
63878
63880
  function createTypeEraser(sources) {
63879
63881
  return createTypeMapper(sources, /*targets*/ undefined);
@@ -73324,6 +73326,14 @@ var ts;
73324
73326
  var lhsType = getTypeOfExpression(e.expression);
73325
73327
  return ts.isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText);
73326
73328
  }
73329
+ if (ts.isElementAccessExpression(e)) {
73330
+ var propType = checkExpressionCached(e.argumentExpression);
73331
+ if (!isTypeUsableAsPropertyName(propType)) {
73332
+ return undefined;
73333
+ }
73334
+ var lhsType = getTypeOfExpression(e.expression);
73335
+ return getPropertyOfType(lhsType, getPropertyNameFromType(propType));
73336
+ }
73327
73337
  return undefined;
73328
73338
  function tryGetPrivateIdentifierPropertyOfType(type, id) {
73329
73339
  var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(id.escapedText, id);
@@ -144709,7 +144719,7 @@ var ts;
144709
144719
  var SmartSelectionRange;
144710
144720
  (function (SmartSelectionRange) {
144711
144721
  function getSmartSelectionRange(pos, sourceFile) {
144712
- var _a;
144722
+ var _a, _b;
144713
144723
  var selectionRange = {
144714
144724
  textSpan: ts.createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd())
144715
144725
  };
@@ -144761,6 +144771,17 @@ var ts;
144761
144771
  if (ts.hasJSDocNodes(node) && ((_a = node.jsDoc) === null || _a === void 0 ? void 0 : _a.length)) {
144762
144772
  pushSelectionRange(ts.first(node.jsDoc).getStart(), end);
144763
144773
  }
144774
+ // (#39618 & #49807)
144775
+ // When the node is a SyntaxList and its first child has a JSDoc comment, then the node's
144776
+ // `start` (which usually is the result of calling `node.getStart()`) points to the first
144777
+ // token after the JSDoc comment. So, we have to make sure we'd pushed the selection
144778
+ // covering the JSDoc comment before diving further.
144779
+ if (ts.isSyntaxList(node)) {
144780
+ var firstChild = node.getChildren()[0];
144781
+ if (firstChild && ts.hasJSDocNodes(firstChild) && ((_b = firstChild.jsDoc) === null || _b === void 0 ? void 0 : _b.length) && firstChild.getStart() !== node.pos) {
144782
+ start = Math.min(start, ts.first(firstChild.jsDoc).getStart());
144783
+ }
144784
+ }
144764
144785
  pushSelectionRange(start, end);
144765
144786
  // String literals should have a stop both inside and outside their quotes.
144766
144787
  if (ts.isStringLiteral(node) || ts.isTemplateLiteral(node)) {
@@ -144834,6 +144855,7 @@ var ts;
144834
144855
  * other as well as of other top-level statements and declarations.
144835
144856
  */
144836
144857
  function getSelectionChildren(node) {
144858
+ var _a;
144837
144859
  // Group top-level imports
144838
144860
  if (ts.isSourceFile(node)) {
144839
144861
  return groupChildren(node.getChildAt(0).getChildren(), isImport);
@@ -144849,7 +144871,7 @@ var ts;
144849
144871
  // because it allows the mapped type to become an object type with a
144850
144872
  // few keystrokes.
144851
144873
  if (ts.isMappedTypeNode(node)) {
144852
- var _a = node.getChildren(), openBraceToken = _a[0], children = _a.slice(1);
144874
+ var _b = node.getChildren(), openBraceToken = _b[0], children = _b.slice(1);
144853
144875
  var closeBraceToken = ts.Debug.checkDefined(children.pop());
144854
144876
  ts.Debug.assertEqual(openBraceToken.kind, 18 /* OpenBraceToken */);
144855
144877
  ts.Debug.assertEqual(closeBraceToken.kind, 19 /* CloseBraceToken */);
@@ -144880,10 +144902,13 @@ var ts;
144880
144902
  var children = groupChildren(node.getChildren(), function (child) {
144881
144903
  return child === node.name || ts.contains(node.modifiers, child);
144882
144904
  });
144883
- return splitChildren(children, function (_a) {
144905
+ var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* JSDoc */ ? children[0] : undefined;
144906
+ var withJSDocSeparated = firstJSDocChild ? children.slice(1) : children;
144907
+ var splittedChildren = splitChildren(withJSDocSeparated, function (_a) {
144884
144908
  var kind = _a.kind;
144885
144909
  return kind === 58 /* ColonToken */;
144886
144910
  });
144911
+ return firstJSDocChild ? [firstJSDocChild, createSyntaxList(splittedChildren)] : splittedChildren;
144887
144912
  }
144888
144913
  // Group the parameter name with its `...`, then that group with its `?`, then pivot on `=`.
144889
144914
  if (ts.isParameter(node)) {
@@ -303,7 +303,7 @@ var ts;
303
303
  // The following is baselined as a literal template type without intervention
304
304
  /** The version of the TypeScript compiler release */
305
305
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
306
- ts.version = ts.versionMajorMinor + ".0-dev.20220711";
306
+ ts.version = ts.versionMajorMinor + ".0-dev.20220714";
307
307
  /* @internal */
308
308
  var Comparison;
309
309
  (function (Comparison) {
@@ -3350,6 +3350,32 @@ var ts;
3350
3350
  return result;
3351
3351
  }
3352
3352
  Debug.formatVariance = formatVariance;
3353
+ var DebugTypeMapper = /** @class */ (function () {
3354
+ function DebugTypeMapper() {
3355
+ }
3356
+ DebugTypeMapper.prototype.__debugToString = function () {
3357
+ var _a;
3358
+ type(this);
3359
+ switch (this.kind) {
3360
+ case 3 /* Function */: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
3361
+ case 0 /* Simple */: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
3362
+ case 1 /* Array */: return ts.zipWith(this.sources, this.targets || ts.map(this.sources, function () { return "any"; }), function (s, t) { return s.__debugTypeToString() + " -> " + (typeof t === "string" ? t : t.__debugTypeToString()); }).join(", ");
3363
+ case 2 /* Deferred */: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
3364
+ case 5 /* Merged */:
3365
+ case 4 /* Composite */: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
3366
+ default: return assertNever(this);
3367
+ }
3368
+ };
3369
+ return DebugTypeMapper;
3370
+ }());
3371
+ Debug.DebugTypeMapper = DebugTypeMapper;
3372
+ function attachDebugPrototypeIfDebug(mapper) {
3373
+ if (Debug.isDebugging) {
3374
+ return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
3375
+ }
3376
+ return mapper;
3377
+ }
3378
+ Debug.attachDebugPrototypeIfDebug = attachDebugPrototypeIfDebug;
3353
3379
  })(Debug = ts.Debug || (ts.Debug = {}));
3354
3380
  })(ts || (ts = {}));
3355
3381
  /* @internal */
@@ -48901,24 +48927,6 @@ var ts;
48901
48927
  var Symbol = ts.objectAllocator.getSymbolConstructor();
48902
48928
  var Type = ts.objectAllocator.getTypeConstructor();
48903
48929
  var Signature = ts.objectAllocator.getSignatureConstructor();
48904
- var DebugTypeMapper = /** @class */ (function () {
48905
- function DebugTypeMapper() {
48906
- }
48907
- DebugTypeMapper.prototype.__debugToString = function () {
48908
- var _a;
48909
- ts.Debug.type(this);
48910
- switch (this.kind) {
48911
- case 3 /* Function */: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
48912
- case 0 /* Simple */: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
48913
- case 1 /* Array */: return ts.zipWith(this.sources, this.targets || ts.map(this.sources, function () { return anyType; }), function (s, t) { return s.__debugTypeToString() + " -> " + t.__debugTypeToString(); }).join(", ");
48914
- case 2 /* Deferred */: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
48915
- case 5 /* Merged */:
48916
- case 4 /* Composite */: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
48917
- default: return ts.Debug.assertNever(this);
48918
- }
48919
- };
48920
- return DebugTypeMapper;
48921
- }());
48922
48930
  var typeCount = 0;
48923
48931
  var symbolCount = 0;
48924
48932
  var enumCount = 0;
@@ -64048,26 +64056,20 @@ var ts;
64048
64056
  return t1 !== type && mapper.kind === 4 /* Composite */ ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2);
64049
64057
  }
64050
64058
  }
64051
- function attachDebugPrototypeIfDebug(mapper) {
64052
- if (ts.Debug.isDebugging) {
64053
- return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
64054
- }
64055
- return mapper;
64056
- }
64057
64059
  function makeUnaryTypeMapper(source, target) {
64058
- return attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
64060
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
64059
64061
  }
64060
64062
  function makeArrayTypeMapper(sources, targets) {
64061
- return attachDebugPrototypeIfDebug({ kind: 1 /* Array */, sources: sources, targets: targets });
64063
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 1 /* Array */, sources: sources, targets: targets });
64062
64064
  }
64063
64065
  function makeFunctionTypeMapper(func, debugInfo) {
64064
- return attachDebugPrototypeIfDebug({ kind: 3 /* Function */, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
64066
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 3 /* Function */, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
64065
64067
  }
64066
64068
  function makeDeferredTypeMapper(sources, targets) {
64067
- return attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
64069
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
64068
64070
  }
64069
64071
  function makeCompositeTypeMapper(kind, mapper1, mapper2) {
64070
- return attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
64072
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
64071
64073
  }
64072
64074
  function createTypeEraser(sources) {
64073
64075
  return createTypeMapper(sources, /*targets*/ undefined);
@@ -73518,6 +73520,14 @@ var ts;
73518
73520
  var lhsType = getTypeOfExpression(e.expression);
73519
73521
  return ts.isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText);
73520
73522
  }
73523
+ if (ts.isElementAccessExpression(e)) {
73524
+ var propType = checkExpressionCached(e.argumentExpression);
73525
+ if (!isTypeUsableAsPropertyName(propType)) {
73526
+ return undefined;
73527
+ }
73528
+ var lhsType = getTypeOfExpression(e.expression);
73529
+ return getPropertyOfType(lhsType, getPropertyNameFromType(propType));
73530
+ }
73521
73531
  return undefined;
73522
73532
  function tryGetPrivateIdentifierPropertyOfType(type, id) {
73523
73533
  var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(id.escapedText, id);
@@ -145322,7 +145332,7 @@ var ts;
145322
145332
  var SmartSelectionRange;
145323
145333
  (function (SmartSelectionRange) {
145324
145334
  function getSmartSelectionRange(pos, sourceFile) {
145325
- var _a;
145335
+ var _a, _b;
145326
145336
  var selectionRange = {
145327
145337
  textSpan: ts.createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd())
145328
145338
  };
@@ -145374,6 +145384,17 @@ var ts;
145374
145384
  if (ts.hasJSDocNodes(node) && ((_a = node.jsDoc) === null || _a === void 0 ? void 0 : _a.length)) {
145375
145385
  pushSelectionRange(ts.first(node.jsDoc).getStart(), end);
145376
145386
  }
145387
+ // (#39618 & #49807)
145388
+ // When the node is a SyntaxList and its first child has a JSDoc comment, then the node's
145389
+ // `start` (which usually is the result of calling `node.getStart()`) points to the first
145390
+ // token after the JSDoc comment. So, we have to make sure we'd pushed the selection
145391
+ // covering the JSDoc comment before diving further.
145392
+ if (ts.isSyntaxList(node)) {
145393
+ var firstChild = node.getChildren()[0];
145394
+ if (firstChild && ts.hasJSDocNodes(firstChild) && ((_b = firstChild.jsDoc) === null || _b === void 0 ? void 0 : _b.length) && firstChild.getStart() !== node.pos) {
145395
+ start = Math.min(start, ts.first(firstChild.jsDoc).getStart());
145396
+ }
145397
+ }
145377
145398
  pushSelectionRange(start, end);
145378
145399
  // String literals should have a stop both inside and outside their quotes.
145379
145400
  if (ts.isStringLiteral(node) || ts.isTemplateLiteral(node)) {
@@ -145447,6 +145468,7 @@ var ts;
145447
145468
  * other as well as of other top-level statements and declarations.
145448
145469
  */
145449
145470
  function getSelectionChildren(node) {
145471
+ var _a;
145450
145472
  // Group top-level imports
145451
145473
  if (ts.isSourceFile(node)) {
145452
145474
  return groupChildren(node.getChildAt(0).getChildren(), isImport);
@@ -145462,7 +145484,7 @@ var ts;
145462
145484
  // because it allows the mapped type to become an object type with a
145463
145485
  // few keystrokes.
145464
145486
  if (ts.isMappedTypeNode(node)) {
145465
- var _a = node.getChildren(), openBraceToken = _a[0], children = _a.slice(1);
145487
+ var _b = node.getChildren(), openBraceToken = _b[0], children = _b.slice(1);
145466
145488
  var closeBraceToken = ts.Debug.checkDefined(children.pop());
145467
145489
  ts.Debug.assertEqual(openBraceToken.kind, 18 /* OpenBraceToken */);
145468
145490
  ts.Debug.assertEqual(closeBraceToken.kind, 19 /* CloseBraceToken */);
@@ -145493,10 +145515,13 @@ var ts;
145493
145515
  var children = groupChildren(node.getChildren(), function (child) {
145494
145516
  return child === node.name || ts.contains(node.modifiers, child);
145495
145517
  });
145496
- return splitChildren(children, function (_a) {
145518
+ var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* JSDoc */ ? children[0] : undefined;
145519
+ var withJSDocSeparated = firstJSDocChild ? children.slice(1) : children;
145520
+ var splittedChildren = splitChildren(withJSDocSeparated, function (_a) {
145497
145521
  var kind = _a.kind;
145498
145522
  return kind === 58 /* ColonToken */;
145499
145523
  });
145524
+ return firstJSDocChild ? [firstJSDocChild, createSyntaxList(splittedChildren)] : splittedChildren;
145500
145525
  }
145501
145526
  // Group the parameter name with its `...`, then that group with its `?`, then pivot on `=`.
145502
145527
  if (ts.isParameter(node)) {
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.20220711";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220714";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -3341,6 +3341,32 @@ var ts;
3341
3341
  return result;
3342
3342
  }
3343
3343
  Debug.formatVariance = formatVariance;
3344
+ var DebugTypeMapper = /** @class */ (function () {
3345
+ function DebugTypeMapper() {
3346
+ }
3347
+ DebugTypeMapper.prototype.__debugToString = function () {
3348
+ var _a;
3349
+ type(this);
3350
+ switch (this.kind) {
3351
+ case 3 /* Function */: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
3352
+ case 0 /* Simple */: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
3353
+ case 1 /* Array */: return ts.zipWith(this.sources, this.targets || ts.map(this.sources, function () { return "any"; }), function (s, t) { return s.__debugTypeToString() + " -> " + (typeof t === "string" ? t : t.__debugTypeToString()); }).join(", ");
3354
+ case 2 /* Deferred */: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
3355
+ case 5 /* Merged */:
3356
+ case 4 /* Composite */: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
3357
+ default: return assertNever(this);
3358
+ }
3359
+ };
3360
+ return DebugTypeMapper;
3361
+ }());
3362
+ Debug.DebugTypeMapper = DebugTypeMapper;
3363
+ function attachDebugPrototypeIfDebug(mapper) {
3364
+ if (Debug.isDebugging) {
3365
+ return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
3366
+ }
3367
+ return mapper;
3368
+ }
3369
+ Debug.attachDebugPrototypeIfDebug = attachDebugPrototypeIfDebug;
3344
3370
  })(Debug = ts.Debug || (ts.Debug = {}));
3345
3371
  })(ts || (ts = {}));
3346
3372
  /* @internal */
@@ -48892,24 +48918,6 @@ var ts;
48892
48918
  var Symbol = ts.objectAllocator.getSymbolConstructor();
48893
48919
  var Type = ts.objectAllocator.getTypeConstructor();
48894
48920
  var Signature = ts.objectAllocator.getSignatureConstructor();
48895
- var DebugTypeMapper = /** @class */ (function () {
48896
- function DebugTypeMapper() {
48897
- }
48898
- DebugTypeMapper.prototype.__debugToString = function () {
48899
- var _a;
48900
- ts.Debug.type(this);
48901
- switch (this.kind) {
48902
- case 3 /* Function */: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
48903
- case 0 /* Simple */: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
48904
- case 1 /* Array */: return ts.zipWith(this.sources, this.targets || ts.map(this.sources, function () { return anyType; }), function (s, t) { return s.__debugTypeToString() + " -> " + t.__debugTypeToString(); }).join(", ");
48905
- case 2 /* Deferred */: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
48906
- case 5 /* Merged */:
48907
- case 4 /* Composite */: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
48908
- default: return ts.Debug.assertNever(this);
48909
- }
48910
- };
48911
- return DebugTypeMapper;
48912
- }());
48913
48921
  var typeCount = 0;
48914
48922
  var symbolCount = 0;
48915
48923
  var enumCount = 0;
@@ -64039,26 +64047,20 @@ var ts;
64039
64047
  return t1 !== type && mapper.kind === 4 /* Composite */ ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2);
64040
64048
  }
64041
64049
  }
64042
- function attachDebugPrototypeIfDebug(mapper) {
64043
- if (ts.Debug.isDebugging) {
64044
- return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
64045
- }
64046
- return mapper;
64047
- }
64048
64050
  function makeUnaryTypeMapper(source, target) {
64049
- return attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
64051
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
64050
64052
  }
64051
64053
  function makeArrayTypeMapper(sources, targets) {
64052
- return attachDebugPrototypeIfDebug({ kind: 1 /* Array */, sources: sources, targets: targets });
64054
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 1 /* Array */, sources: sources, targets: targets });
64053
64055
  }
64054
64056
  function makeFunctionTypeMapper(func, debugInfo) {
64055
- return attachDebugPrototypeIfDebug({ kind: 3 /* Function */, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
64057
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 3 /* Function */, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
64056
64058
  }
64057
64059
  function makeDeferredTypeMapper(sources, targets) {
64058
- return attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
64060
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
64059
64061
  }
64060
64062
  function makeCompositeTypeMapper(kind, mapper1, mapper2) {
64061
- return attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
64063
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
64062
64064
  }
64063
64065
  function createTypeEraser(sources) {
64064
64066
  return createTypeMapper(sources, /*targets*/ undefined);
@@ -73509,6 +73511,14 @@ var ts;
73509
73511
  var lhsType = getTypeOfExpression(e.expression);
73510
73512
  return ts.isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText);
73511
73513
  }
73514
+ if (ts.isElementAccessExpression(e)) {
73515
+ var propType = checkExpressionCached(e.argumentExpression);
73516
+ if (!isTypeUsableAsPropertyName(propType)) {
73517
+ return undefined;
73518
+ }
73519
+ var lhsType = getTypeOfExpression(e.expression);
73520
+ return getPropertyOfType(lhsType, getPropertyNameFromType(propType));
73521
+ }
73512
73522
  return undefined;
73513
73523
  function tryGetPrivateIdentifierPropertyOfType(type, id) {
73514
73524
  var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(id.escapedText, id);
@@ -145313,7 +145323,7 @@ var ts;
145313
145323
  var SmartSelectionRange;
145314
145324
  (function (SmartSelectionRange) {
145315
145325
  function getSmartSelectionRange(pos, sourceFile) {
145316
- var _a;
145326
+ var _a, _b;
145317
145327
  var selectionRange = {
145318
145328
  textSpan: ts.createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd())
145319
145329
  };
@@ -145365,6 +145375,17 @@ var ts;
145365
145375
  if (ts.hasJSDocNodes(node) && ((_a = node.jsDoc) === null || _a === void 0 ? void 0 : _a.length)) {
145366
145376
  pushSelectionRange(ts.first(node.jsDoc).getStart(), end);
145367
145377
  }
145378
+ // (#39618 & #49807)
145379
+ // When the node is a SyntaxList and its first child has a JSDoc comment, then the node's
145380
+ // `start` (which usually is the result of calling `node.getStart()`) points to the first
145381
+ // token after the JSDoc comment. So, we have to make sure we'd pushed the selection
145382
+ // covering the JSDoc comment before diving further.
145383
+ if (ts.isSyntaxList(node)) {
145384
+ var firstChild = node.getChildren()[0];
145385
+ if (firstChild && ts.hasJSDocNodes(firstChild) && ((_b = firstChild.jsDoc) === null || _b === void 0 ? void 0 : _b.length) && firstChild.getStart() !== node.pos) {
145386
+ start = Math.min(start, ts.first(firstChild.jsDoc).getStart());
145387
+ }
145388
+ }
145368
145389
  pushSelectionRange(start, end);
145369
145390
  // String literals should have a stop both inside and outside their quotes.
145370
145391
  if (ts.isStringLiteral(node) || ts.isTemplateLiteral(node)) {
@@ -145438,6 +145459,7 @@ var ts;
145438
145459
  * other as well as of other top-level statements and declarations.
145439
145460
  */
145440
145461
  function getSelectionChildren(node) {
145462
+ var _a;
145441
145463
  // Group top-level imports
145442
145464
  if (ts.isSourceFile(node)) {
145443
145465
  return groupChildren(node.getChildAt(0).getChildren(), isImport);
@@ -145453,7 +145475,7 @@ var ts;
145453
145475
  // because it allows the mapped type to become an object type with a
145454
145476
  // few keystrokes.
145455
145477
  if (ts.isMappedTypeNode(node)) {
145456
- var _a = node.getChildren(), openBraceToken = _a[0], children = _a.slice(1);
145478
+ var _b = node.getChildren(), openBraceToken = _b[0], children = _b.slice(1);
145457
145479
  var closeBraceToken = ts.Debug.checkDefined(children.pop());
145458
145480
  ts.Debug.assertEqual(openBraceToken.kind, 18 /* OpenBraceToken */);
145459
145481
  ts.Debug.assertEqual(closeBraceToken.kind, 19 /* CloseBraceToken */);
@@ -145484,10 +145506,13 @@ var ts;
145484
145506
  var children = groupChildren(node.getChildren(), function (child) {
145485
145507
  return child === node.name || ts.contains(node.modifiers, child);
145486
145508
  });
145487
- return splitChildren(children, function (_a) {
145509
+ var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* JSDoc */ ? children[0] : undefined;
145510
+ var withJSDocSeparated = firstJSDocChild ? children.slice(1) : children;
145511
+ var splittedChildren = splitChildren(withJSDocSeparated, function (_a) {
145488
145512
  var kind = _a.kind;
145489
145513
  return kind === 58 /* ColonToken */;
145490
145514
  });
145515
+ return firstJSDocChild ? [firstJSDocChild, createSyntaxList(splittedChildren)] : splittedChildren;
145491
145516
  }
145492
145517
  // Group the parameter name with its `...`, then that group with its `?`, then pivot on `=`.
145493
145518
  if (ts.isParameter(node)) {
@@ -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.20220711";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220714";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -3341,6 +3341,32 @@ var ts;
3341
3341
  return result;
3342
3342
  }
3343
3343
  Debug.formatVariance = formatVariance;
3344
+ var DebugTypeMapper = /** @class */ (function () {
3345
+ function DebugTypeMapper() {
3346
+ }
3347
+ DebugTypeMapper.prototype.__debugToString = function () {
3348
+ var _a;
3349
+ type(this);
3350
+ switch (this.kind) {
3351
+ case 3 /* Function */: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
3352
+ case 0 /* Simple */: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
3353
+ case 1 /* Array */: return ts.zipWith(this.sources, this.targets || ts.map(this.sources, function () { return "any"; }), function (s, t) { return s.__debugTypeToString() + " -> " + (typeof t === "string" ? t : t.__debugTypeToString()); }).join(", ");
3354
+ case 2 /* Deferred */: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
3355
+ case 5 /* Merged */:
3356
+ case 4 /* Composite */: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
3357
+ default: return assertNever(this);
3358
+ }
3359
+ };
3360
+ return DebugTypeMapper;
3361
+ }());
3362
+ Debug.DebugTypeMapper = DebugTypeMapper;
3363
+ function attachDebugPrototypeIfDebug(mapper) {
3364
+ if (Debug.isDebugging) {
3365
+ return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
3366
+ }
3367
+ return mapper;
3368
+ }
3369
+ Debug.attachDebugPrototypeIfDebug = attachDebugPrototypeIfDebug;
3344
3370
  })(Debug = ts.Debug || (ts.Debug = {}));
3345
3371
  })(ts || (ts = {}));
3346
3372
  /* @internal */
@@ -48892,24 +48918,6 @@ var ts;
48892
48918
  var Symbol = ts.objectAllocator.getSymbolConstructor();
48893
48919
  var Type = ts.objectAllocator.getTypeConstructor();
48894
48920
  var Signature = ts.objectAllocator.getSignatureConstructor();
48895
- var DebugTypeMapper = /** @class */ (function () {
48896
- function DebugTypeMapper() {
48897
- }
48898
- DebugTypeMapper.prototype.__debugToString = function () {
48899
- var _a;
48900
- ts.Debug.type(this);
48901
- switch (this.kind) {
48902
- case 3 /* Function */: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
48903
- case 0 /* Simple */: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
48904
- case 1 /* Array */: return ts.zipWith(this.sources, this.targets || ts.map(this.sources, function () { return anyType; }), function (s, t) { return s.__debugTypeToString() + " -> " + t.__debugTypeToString(); }).join(", ");
48905
- case 2 /* Deferred */: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
48906
- case 5 /* Merged */:
48907
- case 4 /* Composite */: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
48908
- default: return ts.Debug.assertNever(this);
48909
- }
48910
- };
48911
- return DebugTypeMapper;
48912
- }());
48913
48921
  var typeCount = 0;
48914
48922
  var symbolCount = 0;
48915
48923
  var enumCount = 0;
@@ -64039,26 +64047,20 @@ var ts;
64039
64047
  return t1 !== type && mapper.kind === 4 /* Composite */ ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2);
64040
64048
  }
64041
64049
  }
64042
- function attachDebugPrototypeIfDebug(mapper) {
64043
- if (ts.Debug.isDebugging) {
64044
- return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
64045
- }
64046
- return mapper;
64047
- }
64048
64050
  function makeUnaryTypeMapper(source, target) {
64049
- return attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
64051
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
64050
64052
  }
64051
64053
  function makeArrayTypeMapper(sources, targets) {
64052
- return attachDebugPrototypeIfDebug({ kind: 1 /* Array */, sources: sources, targets: targets });
64054
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 1 /* Array */, sources: sources, targets: targets });
64053
64055
  }
64054
64056
  function makeFunctionTypeMapper(func, debugInfo) {
64055
- return attachDebugPrototypeIfDebug({ kind: 3 /* Function */, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
64057
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 3 /* Function */, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
64056
64058
  }
64057
64059
  function makeDeferredTypeMapper(sources, targets) {
64058
- return attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
64060
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
64059
64061
  }
64060
64062
  function makeCompositeTypeMapper(kind, mapper1, mapper2) {
64061
- return attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
64063
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
64062
64064
  }
64063
64065
  function createTypeEraser(sources) {
64064
64066
  return createTypeMapper(sources, /*targets*/ undefined);
@@ -73509,6 +73511,14 @@ var ts;
73509
73511
  var lhsType = getTypeOfExpression(e.expression);
73510
73512
  return ts.isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText);
73511
73513
  }
73514
+ if (ts.isElementAccessExpression(e)) {
73515
+ var propType = checkExpressionCached(e.argumentExpression);
73516
+ if (!isTypeUsableAsPropertyName(propType)) {
73517
+ return undefined;
73518
+ }
73519
+ var lhsType = getTypeOfExpression(e.expression);
73520
+ return getPropertyOfType(lhsType, getPropertyNameFromType(propType));
73521
+ }
73512
73522
  return undefined;
73513
73523
  function tryGetPrivateIdentifierPropertyOfType(type, id) {
73514
73524
  var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(id.escapedText, id);
@@ -145313,7 +145323,7 @@ var ts;
145313
145323
  var SmartSelectionRange;
145314
145324
  (function (SmartSelectionRange) {
145315
145325
  function getSmartSelectionRange(pos, sourceFile) {
145316
- var _a;
145326
+ var _a, _b;
145317
145327
  var selectionRange = {
145318
145328
  textSpan: ts.createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd())
145319
145329
  };
@@ -145365,6 +145375,17 @@ var ts;
145365
145375
  if (ts.hasJSDocNodes(node) && ((_a = node.jsDoc) === null || _a === void 0 ? void 0 : _a.length)) {
145366
145376
  pushSelectionRange(ts.first(node.jsDoc).getStart(), end);
145367
145377
  }
145378
+ // (#39618 & #49807)
145379
+ // When the node is a SyntaxList and its first child has a JSDoc comment, then the node's
145380
+ // `start` (which usually is the result of calling `node.getStart()`) points to the first
145381
+ // token after the JSDoc comment. So, we have to make sure we'd pushed the selection
145382
+ // covering the JSDoc comment before diving further.
145383
+ if (ts.isSyntaxList(node)) {
145384
+ var firstChild = node.getChildren()[0];
145385
+ if (firstChild && ts.hasJSDocNodes(firstChild) && ((_b = firstChild.jsDoc) === null || _b === void 0 ? void 0 : _b.length) && firstChild.getStart() !== node.pos) {
145386
+ start = Math.min(start, ts.first(firstChild.jsDoc).getStart());
145387
+ }
145388
+ }
145368
145389
  pushSelectionRange(start, end);
145369
145390
  // String literals should have a stop both inside and outside their quotes.
145370
145391
  if (ts.isStringLiteral(node) || ts.isTemplateLiteral(node)) {
@@ -145438,6 +145459,7 @@ var ts;
145438
145459
  * other as well as of other top-level statements and declarations.
145439
145460
  */
145440
145461
  function getSelectionChildren(node) {
145462
+ var _a;
145441
145463
  // Group top-level imports
145442
145464
  if (ts.isSourceFile(node)) {
145443
145465
  return groupChildren(node.getChildAt(0).getChildren(), isImport);
@@ -145453,7 +145475,7 @@ var ts;
145453
145475
  // because it allows the mapped type to become an object type with a
145454
145476
  // few keystrokes.
145455
145477
  if (ts.isMappedTypeNode(node)) {
145456
- var _a = node.getChildren(), openBraceToken = _a[0], children = _a.slice(1);
145478
+ var _b = node.getChildren(), openBraceToken = _b[0], children = _b.slice(1);
145457
145479
  var closeBraceToken = ts.Debug.checkDefined(children.pop());
145458
145480
  ts.Debug.assertEqual(openBraceToken.kind, 18 /* OpenBraceToken */);
145459
145481
  ts.Debug.assertEqual(closeBraceToken.kind, 19 /* CloseBraceToken */);
@@ -145484,10 +145506,13 @@ var ts;
145484
145506
  var children = groupChildren(node.getChildren(), function (child) {
145485
145507
  return child === node.name || ts.contains(node.modifiers, child);
145486
145508
  });
145487
- return splitChildren(children, function (_a) {
145509
+ var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* JSDoc */ ? children[0] : undefined;
145510
+ var withJSDocSeparated = firstJSDocChild ? children.slice(1) : children;
145511
+ var splittedChildren = splitChildren(withJSDocSeparated, function (_a) {
145488
145512
  var kind = _a.kind;
145489
145513
  return kind === 58 /* ColonToken */;
145490
145514
  });
145515
+ return firstJSDocChild ? [firstJSDocChild, createSyntaxList(splittedChildren)] : splittedChildren;
145491
145516
  }
145492
145517
  // Group the parameter name with its `...`, then that group with its `?`, then pivot on `=`.
145493
145518
  if (ts.isParameter(node)) {
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-dev.20220711";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220714";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -3136,6 +3136,32 @@ var ts;
3136
3136
  return result;
3137
3137
  }
3138
3138
  Debug.formatVariance = formatVariance;
3139
+ var DebugTypeMapper = /** @class */ (function () {
3140
+ function DebugTypeMapper() {
3141
+ }
3142
+ DebugTypeMapper.prototype.__debugToString = function () {
3143
+ var _a;
3144
+ type(this);
3145
+ switch (this.kind) {
3146
+ case 3 /* Function */: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
3147
+ case 0 /* Simple */: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
3148
+ case 1 /* Array */: return ts.zipWith(this.sources, this.targets || ts.map(this.sources, function () { return "any"; }), function (s, t) { return s.__debugTypeToString() + " -> " + (typeof t === "string" ? t : t.__debugTypeToString()); }).join(", ");
3149
+ case 2 /* Deferred */: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
3150
+ case 5 /* Merged */:
3151
+ case 4 /* Composite */: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
3152
+ default: return assertNever(this);
3153
+ }
3154
+ };
3155
+ return DebugTypeMapper;
3156
+ }());
3157
+ Debug.DebugTypeMapper = DebugTypeMapper;
3158
+ function attachDebugPrototypeIfDebug(mapper) {
3159
+ if (Debug.isDebugging) {
3160
+ return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
3161
+ }
3162
+ return mapper;
3163
+ }
3164
+ Debug.attachDebugPrototypeIfDebug = attachDebugPrototypeIfDebug;
3139
3165
  })(Debug = ts.Debug || (ts.Debug = {}));
3140
3166
  })(ts || (ts = {}));
3141
3167
  /* @internal */
@@ -48687,24 +48713,6 @@ var ts;
48687
48713
  var Symbol = ts.objectAllocator.getSymbolConstructor();
48688
48714
  var Type = ts.objectAllocator.getTypeConstructor();
48689
48715
  var Signature = ts.objectAllocator.getSignatureConstructor();
48690
- var DebugTypeMapper = /** @class */ (function () {
48691
- function DebugTypeMapper() {
48692
- }
48693
- DebugTypeMapper.prototype.__debugToString = function () {
48694
- var _a;
48695
- ts.Debug.type(this);
48696
- switch (this.kind) {
48697
- case 3 /* Function */: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
48698
- case 0 /* Simple */: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
48699
- case 1 /* Array */: return ts.zipWith(this.sources, this.targets || ts.map(this.sources, function () { return anyType; }), function (s, t) { return s.__debugTypeToString() + " -> " + t.__debugTypeToString(); }).join(", ");
48700
- case 2 /* Deferred */: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
48701
- case 5 /* Merged */:
48702
- case 4 /* Composite */: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
48703
- default: return ts.Debug.assertNever(this);
48704
- }
48705
- };
48706
- return DebugTypeMapper;
48707
- }());
48708
48716
  var typeCount = 0;
48709
48717
  var symbolCount = 0;
48710
48718
  var enumCount = 0;
@@ -63834,26 +63842,20 @@ var ts;
63834
63842
  return t1 !== type && mapper.kind === 4 /* Composite */ ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2);
63835
63843
  }
63836
63844
  }
63837
- function attachDebugPrototypeIfDebug(mapper) {
63838
- if (ts.Debug.isDebugging) {
63839
- return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
63840
- }
63841
- return mapper;
63842
- }
63843
63845
  function makeUnaryTypeMapper(source, target) {
63844
- return attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
63846
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
63845
63847
  }
63846
63848
  function makeArrayTypeMapper(sources, targets) {
63847
- return attachDebugPrototypeIfDebug({ kind: 1 /* Array */, sources: sources, targets: targets });
63849
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 1 /* Array */, sources: sources, targets: targets });
63848
63850
  }
63849
63851
  function makeFunctionTypeMapper(func, debugInfo) {
63850
- return attachDebugPrototypeIfDebug({ kind: 3 /* Function */, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
63852
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 3 /* Function */, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
63851
63853
  }
63852
63854
  function makeDeferredTypeMapper(sources, targets) {
63853
- return attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
63855
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
63854
63856
  }
63855
63857
  function makeCompositeTypeMapper(kind, mapper1, mapper2) {
63856
- return attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
63858
+ return ts.Debug.attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
63857
63859
  }
63858
63860
  function createTypeEraser(sources) {
63859
63861
  return createTypeMapper(sources, /*targets*/ undefined);
@@ -73304,6 +73306,14 @@ var ts;
73304
73306
  var lhsType = getTypeOfExpression(e.expression);
73305
73307
  return ts.isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText);
73306
73308
  }
73309
+ if (ts.isElementAccessExpression(e)) {
73310
+ var propType = checkExpressionCached(e.argumentExpression);
73311
+ if (!isTypeUsableAsPropertyName(propType)) {
73312
+ return undefined;
73313
+ }
73314
+ var lhsType = getTypeOfExpression(e.expression);
73315
+ return getPropertyOfType(lhsType, getPropertyNameFromType(propType));
73316
+ }
73307
73317
  return undefined;
73308
73318
  function tryGetPrivateIdentifierPropertyOfType(type, id) {
73309
73319
  var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(id.escapedText, id);
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.8.0-dev.20220711",
5
+ "version": "4.8.0-dev.20220714",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [