typescript 4.2.0-dev.20210208 → 4.2.2

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.
@@ -85,7 +85,7 @@ var ts;
85
85
  // The following is baselined as a literal template type without intervention
86
86
  /** The version of the TypeScript compiler release */
87
87
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
88
- ts.version = ts.versionMajorMinor + ".0-dev.20210208";
88
+ ts.version = "4.2.2";
89
89
  /* @internal */
90
90
  var Comparison;
91
91
  (function (Comparison) {
@@ -3452,39 +3452,41 @@ var ts;
3452
3452
  /** Performance logger that will generate ETW events if possible - check for `logEvent` member, as `etwModule` will be `{}` when browserified */
3453
3453
  ts.perfLogger = etwModule && etwModule.logEvent ? etwModule : nullLogger;
3454
3454
  })(ts || (ts = {}));
3455
+ /* Tracing events for the compiler. */
3455
3456
  /*@internal*/
3456
- /** Tracing events for the compiler. */
3457
3457
  var ts;
3458
3458
  (function (ts) {
3459
- var tracing;
3460
- (function (tracing) {
3459
+ // enable the above using startTracing()
3460
+ })(ts || (ts = {}));
3461
+ // `tracingEnabled` should never be used directly, only through the above
3462
+ /* @internal */
3463
+ (function (ts) {
3464
+ var tracingEnabled;
3465
+ (function (tracingEnabled) {
3461
3466
  var Mode;
3462
3467
  (function (Mode) {
3463
3468
  Mode[Mode["Project"] = 0] = "Project";
3464
3469
  Mode[Mode["Build"] = 1] = "Build";
3465
3470
  Mode[Mode["Server"] = 2] = "Server";
3466
- })(Mode = tracing.Mode || (tracing.Mode = {}));
3471
+ })(Mode = tracingEnabled.Mode || (tracingEnabled.Mode = {}));
3467
3472
  var fs;
3468
3473
  var traceCount = 0;
3469
- var traceFd;
3474
+ var traceFd = 0;
3470
3475
  var mode;
3471
3476
  var legendPath;
3472
3477
  var legend = [];
3473
3478
  ;
3474
- /** Starts tracing for the given project (unless the `fs` module is unavailable). */
3479
+ /** Starts tracing for the given project. */
3475
3480
  function startTracing(tracingMode, traceDir, configFilePath) {
3476
- ts.Debug.assert(!traceFd, "Tracing already started");
3481
+ ts.Debug.assert(!ts.tracing, "Tracing already started");
3477
3482
  if (fs === undefined) {
3478
3483
  try {
3479
3484
  fs = require("fs");
3480
3485
  }
3481
- catch (_a) {
3482
- fs = false;
3486
+ catch (e) {
3487
+ throw new Error("tracing requires having fs\n(original error: " + (e.message || e) + ")");
3483
3488
  }
3484
3489
  }
3485
- if (!fs) {
3486
- return;
3487
- }
3488
3490
  mode = tracingMode;
3489
3491
  if (legendPath === undefined) {
3490
3492
  legendPath = ts.combinePaths(traceDir, "legend.json");
@@ -3493,9 +3495,9 @@ var ts;
3493
3495
  if (!fs.existsSync(traceDir)) {
3494
3496
  fs.mkdirSync(traceDir, { recursive: true });
3495
3497
  }
3496
- var countPart = mode === 1 /* Build */ ? "." + process.pid + "-" + ++traceCount :
3497
- mode === 2 /* Server */ ? "." + process.pid :
3498
- "";
3498
+ var countPart = mode === 1 /* Build */ ? "." + process.pid + "-" + ++traceCount
3499
+ : mode === 2 /* Server */ ? "." + process.pid
3500
+ : "";
3499
3501
  var tracePath = ts.combinePaths(traceDir, "trace" + countPart + ".json");
3500
3502
  var typesPath = ts.combinePaths(traceDir, "types" + countPart + ".json");
3501
3503
  legend.push({
@@ -3504,24 +3506,21 @@ var ts;
3504
3506
  typesPath: typesPath,
3505
3507
  });
3506
3508
  traceFd = fs.openSync(tracePath, "w");
3509
+ ts.tracing = tracingEnabled; // only when traceFd is properly set
3507
3510
  // Start with a prefix that contains some metadata that the devtools profiler expects (also avoids a warning on import)
3508
3511
  var meta = { cat: "__metadata", ph: "M", ts: 1000 * ts.timestamp(), pid: 1, tid: 1 };
3509
3512
  fs.writeSync(traceFd, "[\n"
3510
3513
  + [__assign({ name: "process_name", args: { name: "tsc" } }, meta), __assign({ name: "thread_name", args: { name: "Main" } }, meta), __assign(__assign({ name: "TracingStartedInBrowser" }, meta), { cat: "disabled-by-default-devtools.timeline" })]
3511
3514
  .map(function (v) { return JSON.stringify(v); }).join(",\n"));
3512
3515
  }
3513
- tracing.startTracing = startTracing;
3514
- /** Stops tracing for the in-progress project and dumps the type catalog (unless the `fs` module is unavailable). */
3516
+ tracingEnabled.startTracing = startTracing;
3517
+ /** Stops tracing for the in-progress project and dumps the type catalog. */
3515
3518
  function stopTracing(typeCatalog) {
3516
- if (!traceFd) {
3517
- ts.Debug.assert(!fs, "Tracing is not in progress");
3518
- return;
3519
- }
3520
- ts.Debug.assert(fs);
3519
+ ts.Debug.assert(ts.tracing, "Tracing is not in progress");
3521
3520
  ts.Debug.assert(!!typeCatalog === (mode !== 2 /* Server */)); // Have a type catalog iff not in server mode
3522
3521
  fs.writeSync(traceFd, "\n]\n");
3523
3522
  fs.closeSync(traceFd);
3524
- traceFd = undefined;
3523
+ ts.tracing = undefined;
3525
3524
  if (typeCatalog) {
3526
3525
  dumpTypes(typeCatalog);
3527
3526
  }
@@ -3531,11 +3530,7 @@ var ts;
3531
3530
  legend[legend.length - 1].typesPath = undefined;
3532
3531
  }
3533
3532
  }
3534
- tracing.stopTracing = stopTracing;
3535
- function isTracing() {
3536
- return !!traceFd;
3537
- }
3538
- tracing.isTracing = isTracing;
3533
+ tracingEnabled.stopTracing = stopTracing;
3539
3534
  var Phase;
3540
3535
  (function (Phase) {
3541
3536
  Phase["Parse"] = "parse";
@@ -3545,13 +3540,11 @@ var ts;
3545
3540
  Phase["CheckTypes"] = "checkTypes";
3546
3541
  Phase["Emit"] = "emit";
3547
3542
  Phase["Session"] = "session";
3548
- })(Phase = tracing.Phase || (tracing.Phase = {}));
3543
+ })(Phase = tracingEnabled.Phase || (tracingEnabled.Phase = {}));
3549
3544
  function instant(phase, name, args) {
3550
- if (!traceFd)
3551
- return;
3552
3545
  writeEvent("I", phase, name, args, "\"s\":\"g\"");
3553
3546
  }
3554
- tracing.instant = instant;
3547
+ tracingEnabled.instant = instant;
3555
3548
  var eventStack = [];
3556
3549
  /**
3557
3550
  * @param separateBeginAndEnd - used for special cases where we need the trace point even if the event
@@ -3561,45 +3554,40 @@ var ts;
3561
3554
  */
3562
3555
  function push(phase, name, args, separateBeginAndEnd) {
3563
3556
  if (separateBeginAndEnd === void 0) { separateBeginAndEnd = false; }
3564
- if (!traceFd)
3565
- return;
3566
3557
  if (separateBeginAndEnd) {
3567
3558
  writeEvent("B", phase, name, args);
3568
3559
  }
3569
3560
  eventStack.push({ phase: phase, name: name, args: args, time: 1000 * ts.timestamp(), separateBeginAndEnd: separateBeginAndEnd });
3570
3561
  }
3571
- tracing.push = push;
3562
+ tracingEnabled.push = push;
3572
3563
  function pop() {
3573
- if (!traceFd)
3574
- return;
3575
3564
  ts.Debug.assert(eventStack.length > 0);
3576
3565
  writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp());
3577
3566
  eventStack.length--;
3578
3567
  }
3579
- tracing.pop = pop;
3568
+ tracingEnabled.pop = pop;
3580
3569
  function popAll() {
3581
- if (!traceFd)
3582
- return;
3583
3570
  var endTime = 1000 * ts.timestamp();
3584
3571
  for (var i = eventStack.length - 1; i >= 0; i--) {
3585
3572
  writeStackEvent(i, endTime);
3586
3573
  }
3587
3574
  eventStack.length = 0;
3588
3575
  }
3589
- tracing.popAll = popAll;
3576
+ tracingEnabled.popAll = popAll;
3577
+ // sample every 10ms
3578
+ var sampleInterval = 1000 * 10;
3590
3579
  function writeStackEvent(index, endTime) {
3591
3580
  var _a = eventStack[index], phase = _a.phase, name = _a.name, args = _a.args, time = _a.time, separateBeginAndEnd = _a.separateBeginAndEnd;
3592
3581
  if (separateBeginAndEnd) {
3593
3582
  writeEvent("E", phase, name, args, /*extras*/ undefined, endTime);
3594
3583
  }
3595
- else {
3584
+ // test if [time,endTime) straddles a sampling point
3585
+ else if (sampleInterval - (time % sampleInterval) <= endTime - time) {
3596
3586
  writeEvent("X", phase, name, args, "\"dur\":" + (endTime - time), time);
3597
3587
  }
3598
3588
  }
3599
3589
  function writeEvent(eventType, phase, name, args, extras, time) {
3600
3590
  if (time === void 0) { time = 1000 * ts.timestamp(); }
3601
- ts.Debug.assert(traceFd);
3602
- ts.Debug.assert(fs);
3603
3591
  // In server mode, there's no easy way to dump type information, so we drop events that would require it.
3604
3592
  if (mode === 2 /* Server */ && phase === "checkTypes" /* CheckTypes */)
3605
3593
  return;
@@ -3621,7 +3609,6 @@ var ts;
3621
3609
  }
3622
3610
  function dumpTypes(types) {
3623
3611
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
3624
- ts.Debug.assert(fs);
3625
3612
  ts.performance.mark("beginDumpTypes");
3626
3613
  var typesPath = legend[legend.length - 1].typesPath;
3627
3614
  var typesFd = fs.openSync(typesPath, "w");
@@ -3701,11 +3688,15 @@ var ts;
3701
3688
  if (!legendPath) {
3702
3689
  return;
3703
3690
  }
3704
- ts.Debug.assert(fs);
3705
3691
  fs.writeFileSync(legendPath, JSON.stringify(legend));
3706
3692
  }
3707
- tracing.dumpLegend = dumpLegend;
3708
- })(tracing = ts.tracing || (ts.tracing = {}));
3693
+ tracingEnabled.dumpLegend = dumpLegend;
3694
+ })(tracingEnabled = ts.tracingEnabled || (ts.tracingEnabled = {}));
3695
+ })(ts || (ts = {}));
3696
+ /*@internal*/
3697
+ (function (ts) {
3698
+ // define after tracingEnabled is initialized
3699
+ ts.startTracing = ts.tracingEnabled.startTracing;
3709
3700
  })(ts || (ts = {}));
3710
3701
  var ts;
3711
3702
  (function (ts) {
@@ -18595,7 +18586,7 @@ var ts;
18595
18586
  }
18596
18587
  function Type(checker, flags) {
18597
18588
  this.flags = flags;
18598
- if (ts.Debug.isDebugging || ts.tracing.isTracing()) {
18589
+ if (ts.Debug.isDebugging || ts.tracing) {
18599
18590
  this.checker = checker;
18600
18591
  }
18601
18592
  }
@@ -28578,7 +28569,7 @@ var ts;
28578
28569
  }
28579
28570
  function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) {
28580
28571
  if (setParentNodes === void 0) { setParentNodes = false; }
28581
- ts.tracing.push("parse" /* Parse */, "createSourceFile", { path: fileName }, /*separateBeginAndEnd*/ true);
28572
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("parse" /* Parse */, "createSourceFile", { path: fileName }, /*separateBeginAndEnd*/ true);
28582
28573
  ts.performance.mark("beforeParse");
28583
28574
  var result;
28584
28575
  ts.perfLogger.logStartParseSourceFile(fileName);
@@ -28591,7 +28582,7 @@ var ts;
28591
28582
  ts.perfLogger.logStopParseSourceFile();
28592
28583
  ts.performance.mark("afterParse");
28593
28584
  ts.performance.measure("Parse", "beforeParse", "afterParse");
28594
- ts.tracing.pop();
28585
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
28595
28586
  return result;
28596
28587
  }
28597
28588
  ts.createSourceFile = createSourceFile;
@@ -40258,14 +40249,14 @@ var ts;
40258
40249
  }
40259
40250
  var binder = createBinder();
40260
40251
  function bindSourceFile(file, options) {
40261
- ts.tracing.push("bind" /* Bind */, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
40252
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind" /* Bind */, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
40262
40253
  ts.performance.mark("beforeBind");
40263
40254
  ts.perfLogger.logStartBindFile("" + file.fileName);
40264
40255
  binder(file, options);
40265
40256
  ts.perfLogger.logStopBindFile();
40266
40257
  ts.performance.mark("afterBind");
40267
40258
  ts.performance.measure("Bind", "beforeBind", "afterBind");
40268
- ts.tracing.pop();
40259
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
40269
40260
  }
40270
40261
  ts.bindSourceFile = bindSourceFile;
40271
40262
  function createBinder() {
@@ -55657,7 +55648,7 @@ var ts;
55657
55648
  // caps union types at 1000 unique object types.
55658
55649
  var estimatedCount = (count / (len - i)) * len;
55659
55650
  if (estimatedCount > 1000000) {
55660
- ts.tracing.instant("checkTypes" /* CheckTypes */, "removeSubtypes_DepthLimit", { typeIds: types.map(function (t) { return t.id; }) });
55651
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes" /* CheckTypes */, "removeSubtypes_DepthLimit", { typeIds: types.map(function (t) { return t.id; }) });
55661
55652
  error(currentNode, ts.Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
55662
55653
  return false;
55663
55654
  }
@@ -55675,7 +55666,7 @@ var ts;
55675
55666
  }
55676
55667
  return true;
55677
55668
  }
55678
- function removeRedundantLiteralTypes(types, includes) {
55669
+ function removeRedundantLiteralTypes(types, includes, reduceVoidUndefined) {
55679
55670
  var i = types.length;
55680
55671
  while (i > 0) {
55681
55672
  i--;
@@ -55685,7 +55676,7 @@ var ts;
55685
55676
  flags & 256 /* NumberLiteral */ && includes & 8 /* Number */ ||
55686
55677
  flags & 2048 /* BigIntLiteral */ && includes & 64 /* BigInt */ ||
55687
55678
  flags & 8192 /* UniqueESSymbol */ && includes & 4096 /* ESSymbol */ ||
55688
- flags & 32768 /* Undefined */ && includes & 16384 /* Void */ ||
55679
+ reduceVoidUndefined && flags & 32768 /* Undefined */ && includes & 16384 /* Void */ ||
55689
55680
  isFreshLiteralType(t) && containsType(types, t.regularType);
55690
55681
  if (remove) {
55691
55682
  ts.orderedRemoveItemAt(types, i);
@@ -55753,7 +55744,7 @@ var ts;
55753
55744
  }
55754
55745
  if (unionReduction & (1 /* Literal */ | 2 /* Subtype */)) {
55755
55746
  if (includes & (2944 /* Literal */ | 8192 /* UniqueESSymbol */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
55756
- removeRedundantLiteralTypes(typeSet, includes);
55747
+ removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
55757
55748
  }
55758
55749
  if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
55759
55750
  removeStringLiteralsMatchedByTemplateLiterals(typeSet);
@@ -56127,7 +56118,7 @@ var ts;
56127
56118
  function checkCrossProductUnion(types) {
56128
56119
  var size = getCrossProductUnionSize(types);
56129
56120
  if (size >= 100000) {
56130
- ts.tracing.instant("checkTypes" /* CheckTypes */, "checkCrossProductUnion_DepthLimit", { typeIds: types.map(function (t) { return t.id; }), size: size });
56121
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes" /* CheckTypes */, "checkCrossProductUnion_DepthLimit", { typeIds: types.map(function (t) { return t.id; }), size: size });
56131
56122
  error(currentNode, ts.Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
56132
56123
  return false;
56133
56124
  }
@@ -57899,7 +57890,7 @@ var ts;
57899
57890
  // We have reached 50 recursive type instantiations and there is a very high likelyhood we're dealing
57900
57891
  // with a combination of infinite generic types that perpetually generate new type identities. We stop
57901
57892
  // the recursion here by yielding the error type.
57902
- ts.tracing.instant("checkTypes" /* CheckTypes */, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth: instantiationDepth, instantiationCount: instantiationCount });
57893
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes" /* CheckTypes */, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth: instantiationDepth, instantiationCount: instantiationCount });
57903
57894
  error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
57904
57895
  return errorType;
57905
57896
  }
@@ -58935,7 +58926,7 @@ var ts;
58935
58926
  reportIncompatibleStack();
58936
58927
  }
58937
58928
  if (overflow) {
58938
- ts.tracing.instant("checkTypes" /* CheckTypes */, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: depth });
58929
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes" /* CheckTypes */, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: depth });
58939
58930
  var diag = error(errorNode || currentNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));
58940
58931
  if (errorOutputContainer) {
58941
58932
  (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag);
@@ -59386,7 +59377,7 @@ var ts;
59386
59377
  }
59387
59378
  }
59388
59379
  function traceUnionsOrIntersectionsTooLarge(source, target) {
59389
- if (!ts.tracing.isTracing()) {
59380
+ if (!ts.tracing) {
59390
59381
  return;
59391
59382
  }
59392
59383
  if ((source.flags & 3145728 /* UnionOrIntersection */) && (target.flags & 3145728 /* UnionOrIntersection */)) {
@@ -59743,7 +59734,7 @@ var ts;
59743
59734
  };
59744
59735
  }
59745
59736
  if (expandingFlags === 3 /* Both */) {
59746
- ts.tracing.instant("checkTypes" /* CheckTypes */, "recursiveTypeRelatedTo_DepthLimit", {
59737
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes" /* CheckTypes */, "recursiveTypeRelatedTo_DepthLimit", {
59747
59738
  sourceId: source.id,
59748
59739
  sourceIdStack: sourceStack.map(function (t) { return t.id; }),
59749
59740
  targetId: target.id,
@@ -59778,9 +59769,9 @@ var ts;
59778
59769
  return result;
59779
59770
  }
59780
59771
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
59781
- ts.tracing.push("checkTypes" /* CheckTypes */, "structuredTypeRelatedTo", { sourceId: source.id, targetId: target.id });
59772
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "structuredTypeRelatedTo", { sourceId: source.id, targetId: target.id });
59782
59773
  var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState);
59783
- ts.tracing.pop();
59774
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
59784
59775
  return result;
59785
59776
  }
59786
59777
  function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState) {
@@ -60292,7 +60283,7 @@ var ts;
60292
60283
  numCombinations *= countTypes(getTypeOfSymbol(sourceProperty));
60293
60284
  if (numCombinations > 25) {
60294
60285
  // We've reached the complexity limit.
60295
- ts.tracing.instant("checkTypes" /* CheckTypes */, "typeRelatedToDiscriminatedType_DepthLimit", { sourceId: source.id, targetId: target.id, numCombinations: numCombinations });
60286
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes" /* CheckTypes */, "typeRelatedToDiscriminatedType_DepthLimit", { sourceId: source.id, targetId: target.id, numCombinations: numCombinations });
60296
60287
  return 0 /* False */;
60297
60288
  }
60298
60289
  }
@@ -61047,7 +61038,7 @@ var ts;
61047
61038
  if (typeParameters === void 0) { typeParameters = ts.emptyArray; }
61048
61039
  var variances = cache.variances;
61049
61040
  if (!variances) {
61050
- ts.tracing.push("checkTypes" /* CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: (_c = (_a = cache.id) !== null && _a !== void 0 ? _a : (_b = cache.declaredType) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : -1 });
61041
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: (_c = (_a = cache.id) !== null && _a !== void 0 ? _a : (_b = cache.declaredType) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : -1 });
61051
61042
  // The emptyArray singleton is used to signal a recursive invocation.
61052
61043
  cache.variances = ts.emptyArray;
61053
61044
  variances = [];
@@ -61086,7 +61077,7 @@ var ts;
61086
61077
  _loop_19(tp);
61087
61078
  }
61088
61079
  cache.variances = variances;
61089
- ts.tracing.pop();
61080
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
61090
61081
  }
61091
61082
  return variances;
61092
61083
  }
@@ -63774,7 +63765,16 @@ var ts;
63774
63765
  var type = getTypeOfDottedName(node.expression, diagnostic);
63775
63766
  if (type) {
63776
63767
  var name = node.name;
63777
- var prop = getPropertyOfType(type, ts.isPrivateIdentifier(name) ? ts.getSymbolNameForPrivateIdentifier(type.symbol, name.escapedText) : name.escapedText);
63768
+ var prop = void 0;
63769
+ if (ts.isPrivateIdentifier(name)) {
63770
+ if (!type.symbol) {
63771
+ return undefined;
63772
+ }
63773
+ prop = getPropertyOfType(type, ts.getSymbolNameForPrivateIdentifier(type.symbol, name.escapedText));
63774
+ }
63775
+ else {
63776
+ prop = getPropertyOfType(type, name.escapedText);
63777
+ }
63778
63778
  return prop && getExplicitTypeOfSymbol(prop, diagnostic);
63779
63779
  }
63780
63780
  return undefined;
@@ -63987,7 +63987,7 @@ var ts;
63987
63987
  if (flowDepth === 2000) {
63988
63988
  // We have made 2000 recursive invocations. To avoid overflowing the call stack we report an error
63989
63989
  // and disable further control flow analysis in the containing function or module body.
63990
- ts.tracing.instant("checkTypes" /* CheckTypes */, "getTypeAtFlowNode_DepthLimit", { flowId: flow.id });
63990
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes" /* CheckTypes */, "getTypeAtFlowNode_DepthLimit", { flowId: flow.id });
63991
63991
  flowAnalysisDisabled = true;
63992
63992
  reportFlowControlError(reference);
63993
63993
  return errorType;
@@ -64840,10 +64840,15 @@ var ts;
64840
64840
  return assignableType;
64841
64841
  }
64842
64842
  }
64843
- // If the candidate type is a subtype of the target type, narrow to the candidate type,
64844
- // if the target type is a subtype of the candidate type, narrow to the target type,
64845
- // otherwise, narrow to an intersection of the two types.
64846
- return isTypeSubtypeOf(candidate, type) ? candidate : isTypeSubtypeOf(type, candidate) ? type : getIntersectionType([type, candidate]);
64843
+ // If the candidate type is a subtype of the target type, narrow to the candidate type.
64844
+ // Otherwise, if the target type is assignable to the candidate type, keep the target type.
64845
+ // Otherwise, if the candidate type is assignable to the target type, narrow to the candidate
64846
+ // type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
64847
+ // two types.
64848
+ return isTypeSubtypeOf(candidate, type) ? candidate :
64849
+ isTypeAssignableTo(type, candidate) ? type :
64850
+ isTypeAssignableTo(candidate, type) ? candidate :
64851
+ getIntersectionType([type, candidate]);
64847
64852
  }
64848
64853
  function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
64849
64854
  if (hasMatchingArgument(callExpression, reference)) {
@@ -72614,7 +72619,7 @@ var ts;
72614
72619
  }
72615
72620
  }
72616
72621
  function checkExpression(node, checkMode, forceTuple) {
72617
- ts.tracing.push("check" /* Check */, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end });
72622
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end });
72618
72623
  var saveCurrentNode = currentNode;
72619
72624
  currentNode = node;
72620
72625
  instantiationCount = 0;
@@ -72624,7 +72629,7 @@ var ts;
72624
72629
  checkConstEnumAccess(node, type);
72625
72630
  }
72626
72631
  currentNode = saveCurrentNode;
72627
- ts.tracing.pop();
72632
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
72628
72633
  return type;
72629
72634
  }
72630
72635
  function checkConstEnumAccess(node, type) {
@@ -75146,10 +75151,10 @@ var ts;
75146
75151
  return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags);
75147
75152
  }
75148
75153
  function checkVariableDeclaration(node) {
75149
- ts.tracing.push("check" /* Check */, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end });
75154
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end });
75150
75155
  checkGrammarVariableDeclaration(node);
75151
75156
  checkVariableLikeDeclaration(node);
75152
- ts.tracing.pop();
75157
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
75153
75158
  }
75154
75159
  function checkBindingElement(node) {
75155
75160
  checkGrammarBindingElement(node);
@@ -75186,7 +75191,9 @@ var ts;
75186
75191
  : ts.isPropertyAccessExpression(location) ? location.name
75187
75192
  : ts.isBinaryExpression(location) && ts.isIdentifier(location.right) ? location.right
75188
75193
  : undefined;
75189
- if (!testedNode) {
75194
+ var isPropertyExpressionCast = ts.isPropertyAccessExpression(location)
75195
+ && ts.isAssertionExpression(ts.skipParentheses(location.expression));
75196
+ if (!testedNode || isPropertyExpressionCast) {
75190
75197
  return;
75191
75198
  }
75192
75199
  var possiblyFalsy = getFalsyFlags(type);
@@ -77956,7 +77963,7 @@ var ts;
77956
77963
  }
77957
77964
  }
77958
77965
  function checkDeferredNode(node) {
77959
- ts.tracing.push("check" /* Check */, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end });
77966
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end });
77960
77967
  var saveCurrentNode = currentNode;
77961
77968
  currentNode = node;
77962
77969
  instantiationCount = 0;
@@ -77992,15 +77999,15 @@ var ts;
77992
77999
  break;
77993
78000
  }
77994
78001
  currentNode = saveCurrentNode;
77995
- ts.tracing.pop();
78002
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
77996
78003
  }
77997
78004
  function checkSourceFile(node) {
77998
- ts.tracing.push("check" /* Check */, "checkSourceFile", { path: node.path }, /*separateBeginAndEnd*/ true);
78005
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkSourceFile", { path: node.path }, /*separateBeginAndEnd*/ true);
77999
78006
  ts.performance.mark("beforeCheck");
78000
78007
  checkSourceFileWorker(node);
78001
78008
  ts.performance.mark("afterCheck");
78002
78009
  ts.performance.measure("Check", "beforeCheck", "afterCheck");
78003
- ts.tracing.pop();
78010
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
78004
78011
  }
78005
78012
  function unusedIsError(kind, isAmbient) {
78006
78013
  if (isAmbient) {
@@ -99977,9 +99984,9 @@ var ts;
99977
99984
  var transformed = [];
99978
99985
  for (var _a = 0, nodes_3 = nodes; _a < nodes_3.length; _a++) {
99979
99986
  var node = nodes_3[_a];
99980
- ts.tracing.push("emit" /* Emit */, "transformNodes", node.kind === 297 /* SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end });
99987
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* Emit */, "transformNodes", node.kind === 297 /* SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end });
99981
99988
  transformed.push((allowDtsFiles ? transformation : transformRoot)(node));
99982
- ts.tracing.pop();
99989
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
99983
99990
  }
99984
99991
  // prevent modification of the lexical environment.
99985
99992
  state = 2 /* Completed */;
@@ -100575,15 +100582,15 @@ var ts;
100575
100582
  sourceFiles: sourceFileOrBundle.sourceFiles.map(function (file) { return relativeToBuildInfo(ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory())); })
100576
100583
  };
100577
100584
  }
100578
- ts.tracing.push("emit" /* Emit */, "emitJsFileOrBundle", { jsFilePath: jsFilePath });
100585
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* Emit */, "emitJsFileOrBundle", { jsFilePath: jsFilePath });
100579
100586
  emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo);
100580
- ts.tracing.pop();
100581
- ts.tracing.push("emit" /* Emit */, "emitDeclarationFileOrBundle", { declarationFilePath: declarationFilePath });
100587
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
100588
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* Emit */, "emitDeclarationFileOrBundle", { declarationFilePath: declarationFilePath });
100582
100589
  emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo);
100583
- ts.tracing.pop();
100584
- ts.tracing.push("emit" /* Emit */, "emitBuildInfo", { buildInfoPath: buildInfoPath });
100590
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
100591
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* Emit */, "emitBuildInfo", { buildInfoPath: buildInfoPath });
100585
100592
  emitBuildInfo(bundleBuildInfo, buildInfoPath);
100586
- ts.tracing.pop();
100593
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
100587
100594
  if (!emitSkipped && emittedFilesList) {
100588
100595
  if (!emitOnlyDtsFiles) {
100589
100596
  if (jsFilePath) {
@@ -106320,7 +106327,7 @@ var ts;
106320
106327
  var modulesWithElidedImports = new ts.Map();
106321
106328
  // Track source files that are source files found by searching under node_modules, as these shouldn't be compiled.
106322
106329
  var sourceFilesFoundSearchingNodeModules = new ts.Map();
106323
- ts.tracing.push("program" /* Program */, "createProgram", { configFilePath: options.configFilePath, rootDir: options.rootDir }, /*separateBeginAndEnd*/ true);
106330
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "createProgram", { configFilePath: options.configFilePath, rootDir: options.rootDir }, /*separateBeginAndEnd*/ true);
106324
106331
  ts.performance.mark("beforeProgram");
106325
106332
  var host = createProgramOptions.host || createCompilerHost(options);
106326
106333
  var configParsingHost = parseConfigHostFromCompilerHostLike(host);
@@ -106396,15 +106403,15 @@ var ts;
106396
106403
  getSourceOfProjectReferenceRedirect: getSourceOfProjectReferenceRedirect,
106397
106404
  forEachResolvedProjectReference: forEachResolvedProjectReference
106398
106405
  }), onProgramCreateComplete = _d.onProgramCreateComplete, fileExists = _d.fileExists, directoryExists = _d.directoryExists;
106399
- ts.tracing.push("program" /* Program */, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
106406
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
106400
106407
  var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
106401
- ts.tracing.pop();
106408
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
106402
106409
  // We set `structuralIsReused` to `undefined` because `tryReuseStructureFromOldProgram` calls `tryReuseStructureFromOldProgram` which checks
106403
106410
  // `structuralIsReused`, which would be a TDZ violation if it was not set in advance to `undefined`.
106404
106411
  var structureIsReused;
106405
- ts.tracing.push("program" /* Program */, "tryReuseStructureFromOldProgram", {});
106412
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "tryReuseStructureFromOldProgram", {});
106406
106413
  structureIsReused = tryReuseStructureFromOldProgram(); // eslint-disable-line prefer-const
106407
- ts.tracing.pop();
106414
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
106408
106415
  if (structureIsReused !== 2 /* Completely */) {
106409
106416
  processingDefaultLibFiles = [];
106410
106417
  processingOtherFiles = [];
@@ -106442,13 +106449,13 @@ var ts;
106442
106449
  });
106443
106450
  }
106444
106451
  }
106445
- ts.tracing.push("program" /* Program */, "processRootFiles", { count: rootNames.length });
106452
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processRootFiles", { count: rootNames.length });
106446
106453
  ts.forEach(rootNames, function (name, index) { return processRootFile(name, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.RootFile, index: index }); });
106447
- ts.tracing.pop();
106454
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
106448
106455
  // load type declarations specified via 'types' argument or implicitly from types/ and node_modules/@types folders
106449
106456
  var typeReferences = rootNames.length ? ts.getAutomaticTypeDirectiveNames(options, host) : ts.emptyArray;
106450
106457
  if (typeReferences.length) {
106451
- ts.tracing.push("program" /* Program */, "processTypeReferences", { count: typeReferences.length });
106458
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferences", { count: typeReferences.length });
106452
106459
  // This containingFilename needs to match with the one used in managed-side
106453
106460
  var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
106454
106461
  var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
@@ -106456,7 +106463,7 @@ var ts;
106456
106463
  for (var i = 0; i < typeReferences.length; i++) {
106457
106464
  processTypeReferenceDirective(typeReferences[i], resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (_b = resolutions[i]) === null || _b === void 0 ? void 0 : _b.packageId });
106458
106465
  }
106459
- ts.tracing.pop();
106466
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
106460
106467
  }
106461
106468
  // Do not process the default library if:
106462
106469
  // - The '--noLib' flag is used.
@@ -106579,19 +106586,19 @@ var ts;
106579
106586
  verifyCompilerOptions();
106580
106587
  ts.performance.mark("afterProgram");
106581
106588
  ts.performance.measure("Program", "beforeProgram", "afterProgram");
106582
- ts.tracing.pop();
106589
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
106583
106590
  return program;
106584
106591
  function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
106585
106592
  if (!moduleNames.length)
106586
106593
  return ts.emptyArray;
106587
106594
  var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
106588
106595
  var redirectedReference = getRedirectReferenceForResolution(containingFile);
106589
- ts.tracing.push("program" /* Program */, "resolveModuleNamesWorker", { containingFileName: containingFileName });
106596
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "resolveModuleNamesWorker", { containingFileName: containingFileName });
106590
106597
  ts.performance.mark("beforeResolveModule");
106591
106598
  var result = actualResolveModuleNamesWorker(moduleNames, containingFileName, reusedNames, redirectedReference);
106592
106599
  ts.performance.mark("afterResolveModule");
106593
106600
  ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
106594
- ts.tracing.pop();
106601
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
106595
106602
  return result;
106596
106603
  }
106597
106604
  function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
@@ -106599,12 +106606,12 @@ var ts;
106599
106606
  return [];
106600
106607
  var containingFileName = !ts.isString(containingFile) ? ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
106601
106608
  var redirectedReference = !ts.isString(containingFile) ? getRedirectReferenceForResolution(containingFile) : undefined;
106602
- ts.tracing.push("program" /* Program */, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName: containingFileName });
106609
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName: containingFileName });
106603
106610
  ts.performance.mark("beforeResolveTypeReference");
106604
106611
  var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference);
106605
106612
  ts.performance.mark("afterResolveTypeReference");
106606
106613
  ts.performance.measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
106607
- ts.tracing.pop();
106614
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
106608
106615
  return result;
106609
106616
  }
106610
106617
  function getRedirectReferenceForResolution(file) {
@@ -107076,7 +107083,7 @@ var ts;
107076
107083
  }
107077
107084
  function emitBuildInfo(writeFileCallback) {
107078
107085
  ts.Debug.assert(!ts.outFile(options));
107079
- ts.tracing.push("emit" /* Emit */, "emitBuildInfo", {}, /*separateBeginAndEnd*/ true);
107086
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* Emit */, "emitBuildInfo", {}, /*separateBeginAndEnd*/ true);
107080
107087
  ts.performance.mark("beforeEmit");
107081
107088
  var emitResult = ts.emitFiles(ts.notImplementedResolver, getEmitHost(writeFileCallback),
107082
107089
  /*targetSourceFile*/ undefined,
@@ -107085,7 +107092,7 @@ var ts;
107085
107092
  /*onlyBuildInfo*/ true);
107086
107093
  ts.performance.mark("afterEmit");
107087
107094
  ts.performance.measure("Emit", "beforeEmit", "afterEmit");
107088
- ts.tracing.pop();
107095
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
107089
107096
  return emitResult;
107090
107097
  }
107091
107098
  function getResolvedProjectReferences() {
@@ -107131,9 +107138,9 @@ var ts;
107131
107138
  return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ false));
107132
107139
  }
107133
107140
  function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers, forceDtsEmit) {
107134
- ts.tracing.push("emit" /* Emit */, "emit", { path: sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.path }, /*separateBeginAndEnd*/ true);
107141
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* Emit */, "emit", { path: sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.path }, /*separateBeginAndEnd*/ true);
107135
107142
  var result = runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers, forceDtsEmit); });
107136
- ts.tracing.pop();
107143
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
107137
107144
  return result;
107138
107145
  }
107139
107146
  function isEmitBlocked(emitFileName) {
@@ -107794,13 +107801,13 @@ var ts;
107794
107801
  }
107795
107802
  // Get source file from normalized fileName
107796
107803
  function findSourceFile(fileName, path, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
107797
- ts.tracing.push("program" /* Program */, "findSourceFile", {
107804
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "findSourceFile", {
107798
107805
  fileName: fileName,
107799
107806
  isDefaultLib: isDefaultLib || undefined,
107800
107807
  fileIncludeKind: ts.FileIncludeKind[reason.kind],
107801
107808
  });
107802
107809
  var result = findSourceFileWorker(fileName, path, isDefaultLib, ignoreNoDefaultLib, reason, packageId);
107803
- ts.tracing.pop();
107810
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
107804
107811
  return result;
107805
107812
  }
107806
107813
  function findSourceFileWorker(fileName, path, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
@@ -108059,9 +108066,9 @@ var ts;
108059
108066
  }
108060
108067
  }
108061
108068
  function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, reason) {
108062
- ts.tracing.push("program" /* Program */, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolveModuleNamesReusingOldState, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : undefined });
108069
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolveModuleNamesReusingOldState, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : undefined });
108063
108070
  processTypeReferenceDirectiveWorker(typeReferenceDirective, resolvedTypeReferenceDirective, reason);
108064
- ts.tracing.pop();
108071
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
108065
108072
  }
108066
108073
  function processTypeReferenceDirectiveWorker(typeReferenceDirective, resolvedTypeReferenceDirective, reason) {
108067
108074
  // If we already found this library as a primary reference - nothing to do