typescript 4.9.0-dev.20221018 → 4.9.0-dev.20221020

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.9";
72
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221018");
72
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221020");
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -55946,7 +55946,7 @@ var ts;
55946
55946
  if (relation !== identityRelation) {
55947
55947
  if (!result && (source.flags & 2097152 || source.flags & 262144 && target.flags & 1048576)) {
55948
55948
  var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
55949
- if (constraint && !(constraint.flags & 131072) && everyType(constraint, function (c) { return c !== source; })) {
55949
+ if (constraint && everyType(constraint, function (c) { return c !== source; })) {
55950
55950
  result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState);
55951
55951
  }
55952
55952
  }
@@ -57526,8 +57526,7 @@ var ts;
57526
57526
  return !!(type.flags & 109440);
57527
57527
  }
57528
57528
  function isUnitLikeType(type) {
57529
- return type.flags & 2097152 ? ts.some(type.types, isUnitType) :
57530
- !!(type.flags & 109440);
57529
+ return isUnitType(getBaseConstraintOrType(type));
57531
57530
  }
57532
57531
  function extractUnitType(type) {
57533
57532
  return type.flags & 2097152 ? ts.find(type.types, isUnitType) || type : type;
@@ -60362,7 +60361,7 @@ var ts;
60362
60361
  type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
60363
60362
  }
60364
60363
  else if (expr.kind === 218 && isMatchingReference(reference, expr.expression)) {
60365
- type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
60364
+ type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
60366
60365
  }
60367
60366
  else {
60368
60367
  if (strictNullChecks) {
@@ -60595,7 +60594,7 @@ var ts;
60595
60594
  !!(prop.flags & 16777216) || assumeTrue :
60596
60595
  !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
60597
60596
  }
60598
- function narrowByInKeyword(type, nameType, assumeTrue) {
60597
+ function narrowTypeByInKeyword(type, nameType, assumeTrue) {
60599
60598
  var name = getPropertyNameFromType(nameType);
60600
60599
  var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, true); });
60601
60600
  if (isKnownProperty) {
@@ -60672,7 +60671,7 @@ var ts;
60672
60671
  return getTypeWithFacts(type, assumeTrue ? 524288 : 65536);
60673
60672
  }
60674
60673
  if (isMatchingReference(reference, target)) {
60675
- return narrowByInKeyword(type, leftType, assumeTrue);
60674
+ return narrowTypeByInKeyword(type, leftType, assumeTrue);
60676
60675
  }
60677
60676
  }
60678
60677
  break;
@@ -60834,7 +60833,7 @@ var ts;
60834
60833
  neverType;
60835
60834
  });
60836
60835
  }
60837
- function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
60836
+ function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
60838
60837
  var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement);
60839
60838
  if (!witnesses) {
60840
60839
  return type;
@@ -61163,10 +61162,10 @@ var ts;
61163
61162
  function markAliasReferenced(symbol, location) {
61164
61163
  if (isNonLocalAlias(symbol, 111551) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551)) {
61165
61164
  var target = resolveAlias(symbol);
61166
- if (getAllSymbolFlags(target) & 111551) {
61165
+ if (getAllSymbolFlags(target) & (111551 | 1048576)) {
61167
61166
  if (compilerOptions.isolatedModules ||
61168
61167
  ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) ||
61169
- !isConstEnumOrConstEnumOnlyModule(target)) {
61168
+ !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) {
61170
61169
  markAliasSymbolAsReferenced(symbol);
61171
61170
  }
61172
61171
  else {
@@ -69785,7 +69784,7 @@ var ts;
69785
69784
  if (isGenericObjectType(type)) {
69786
69785
  var baseConstraint = getBaseConstraintOfType(type);
69787
69786
  if (baseConstraint ?
69788
- baseConstraint.flags & 3 || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) :
69787
+ baseConstraint.flags & 3 || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) :
69789
69788
  maybeTypeOfKind(type, 8650752)) {
69790
69789
  return true;
69791
69790
  }
@@ -88705,18 +88704,18 @@ var ts;
88705
88704
  return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis);
88706
88705
  case ts.ModuleKind.CommonJS:
88707
88706
  default:
88708
- return createImportCallExpressionCommonJS(argument, containsLexicalThis);
88707
+ return createImportCallExpressionCommonJS(argument);
88709
88708
  }
88710
88709
  }
88711
88710
  function createImportCallExpressionUMD(arg, containsLexicalThis) {
88712
88711
  needUMDDynamicImportHelper = true;
88713
88712
  if (ts.isSimpleCopiableExpression(arg)) {
88714
88713
  var argClone = ts.isGeneratedIdentifier(arg) ? arg : ts.isStringLiteral(arg) ? factory.createStringLiteralFromNode(arg) : ts.setEmitFlags(ts.setTextRange(factory.cloneNode(arg), arg), 1536);
88715
- return factory.createConditionalExpression(factory.createIdentifier("__syncRequire"), undefined, createImportCallExpressionCommonJS(arg, containsLexicalThis), undefined, createImportCallExpressionAMD(argClone, containsLexicalThis));
88714
+ return factory.createConditionalExpression(factory.createIdentifier("__syncRequire"), undefined, createImportCallExpressionCommonJS(arg), undefined, createImportCallExpressionAMD(argClone, containsLexicalThis));
88716
88715
  }
88717
88716
  else {
88718
88717
  var temp = factory.createTempVariable(hoistVariableDeclaration);
88719
- return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression(factory.createIdentifier("__syncRequire"), undefined, createImportCallExpressionCommonJS(temp, containsLexicalThis), undefined, createImportCallExpressionAMD(temp, containsLexicalThis)));
88718
+ return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression(factory.createIdentifier("__syncRequire"), undefined, createImportCallExpressionCommonJS(temp, true), undefined, createImportCallExpressionAMD(temp, containsLexicalThis)));
88720
88719
  }
88721
88720
  }
88722
88721
  function createImportCallExpressionAMD(arg, containsLexicalThis) {
@@ -88745,9 +88744,10 @@ var ts;
88745
88744
  }
88746
88745
  return promise;
88747
88746
  }
88748
- function createImportCallExpressionCommonJS(arg, containsLexicalThis) {
88747
+ function createImportCallExpressionCommonJS(arg, isInlineable) {
88748
+ var temp = arg && !ts.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined;
88749
88749
  var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), undefined, []);
88750
- var requireCall = factory.createCallExpression(factory.createIdentifier("require"), undefined, arg ? [arg] : []);
88750
+ var requireCall = factory.createCallExpression(factory.createIdentifier("require"), undefined, temp ? [temp] : arg ? [arg] : []);
88751
88751
  if (ts.getESModuleInterop(compilerOptions)) {
88752
88752
  requireCall = emitHelpers().createImportStarHelper(requireCall);
88753
88753
  }
@@ -88757,11 +88757,9 @@ var ts;
88757
88757
  }
88758
88758
  else {
88759
88759
  func = factory.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, factory.createBlock([factory.createReturnStatement(requireCall)]));
88760
- if (containsLexicalThis) {
88761
- ts.setEmitFlags(func, 8);
88762
- }
88763
88760
  }
88764
- return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), undefined, [func]);
88761
+ var downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), undefined, [func]);
88762
+ return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]);
88765
88763
  }
88766
88764
  function getHelperExpressionForExport(node, innerExpr) {
88767
88765
  if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864) {
package/lib/tsserver.js CHANGED
@@ -109,7 +109,7 @@ var ts;
109
109
  // The following is baselined as a literal template type without intervention
110
110
  /** The version of the TypeScript compiler release */
111
111
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
112
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221018");
112
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221020");
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -21720,13 +21720,11 @@ var ts;
21720
21720
  * Creates a `BaseNodeFactory` which can be used to create `Node` instances from the constructors provided by the object allocator.
21721
21721
  */
21722
21722
  function createBaseNodeFactory() {
21723
- // tslint:disable variable-name
21724
21723
  var NodeConstructor;
21725
21724
  var TokenConstructor;
21726
21725
  var IdentifierConstructor;
21727
21726
  var PrivateIdentifierConstructor;
21728
21727
  var SourceFileConstructor;
21729
- // tslint:enable variable-name
21730
21728
  return {
21731
21729
  createBaseSourceFileNode: createBaseSourceFileNode,
21732
21730
  createBaseIdentifierNode: createBaseIdentifierNode,
@@ -27658,11 +27656,9 @@ var ts;
27658
27656
  rawTextScanner.setText("`" + rawText + "`");
27659
27657
  break;
27660
27658
  case 15 /* SyntaxKind.TemplateHead */:
27661
- // tslint:disable-next-line no-invalid-template-strings
27662
27659
  rawTextScanner.setText("`" + rawText + "${");
27663
27660
  break;
27664
27661
  case 16 /* SyntaxKind.TemplateMiddle */:
27665
- // tslint:disable-next-line no-invalid-template-strings
27666
27662
  rawTextScanner.setText("}" + rawText + "${");
27667
27663
  break;
27668
27664
  case 17 /* SyntaxKind.TemplateTail */:
@@ -28021,7 +28017,6 @@ var ts;
28021
28017
  return node;
28022
28018
  }
28023
28019
  ts.createInputFiles = createInputFiles;
28024
- // tslint:disable-next-line variable-name
28025
28020
  var SourceMapSource;
28026
28021
  /**
28027
28022
  * Create an external source map source file reference
@@ -32155,13 +32150,11 @@ var ts;
32155
32150
  var scanner = ts.createScanner(99 /* ScriptTarget.Latest */, /*skipTrivia*/ true);
32156
32151
  var disallowInAndDecoratorContext = 4096 /* NodeFlags.DisallowInContext */ | 16384 /* NodeFlags.DecoratorContext */;
32157
32152
  // capture constructors in 'initializeState' to avoid null checks
32158
- // tslint:disable variable-name
32159
32153
  var NodeConstructor;
32160
32154
  var TokenConstructor;
32161
32155
  var IdentifierConstructor;
32162
32156
  var PrivateIdentifierConstructor;
32163
32157
  var SourceFileConstructor;
32164
- // tslint:enable variable-name
32165
32158
  function countNode(node) {
32166
32159
  nodeCount++;
32167
32160
  return node;
@@ -67009,7 +67002,7 @@ var ts;
67009
67002
  // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
67010
67003
  if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) {
67011
67004
  var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
67012
- if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
67005
+ if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
67013
67006
  // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
67014
67007
  result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
67015
67008
  }
@@ -68898,8 +68891,7 @@ var ts;
68898
68891
  return !!(type.flags & 109440 /* TypeFlags.Unit */);
68899
68892
  }
68900
68893
  function isUnitLikeType(type) {
68901
- return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.some(type.types, isUnitType) :
68902
- !!(type.flags & 109440 /* TypeFlags.Unit */);
68894
+ return isUnitType(getBaseConstraintOrType(type));
68903
68895
  }
68904
68896
  function extractUnitType(type) {
68905
68897
  return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.find(type.types, isUnitType) || type : type;
@@ -72131,7 +72123,7 @@ var ts;
72131
72123
  type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
72132
72124
  }
72133
72125
  else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
72134
- type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
72126
+ type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
72135
72127
  }
72136
72128
  else {
72137
72129
  if (strictNullChecks) {
@@ -72412,7 +72404,7 @@ var ts;
72412
72404
  !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
72413
72405
  !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
72414
72406
  }
72415
- function narrowByInKeyword(type, nameType, assumeTrue) {
72407
+ function narrowTypeByInKeyword(type, nameType, assumeTrue) {
72416
72408
  var name = getPropertyNameFromType(nameType);
72417
72409
  var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
72418
72410
  if (isKnownProperty) {
@@ -72493,7 +72485,7 @@ var ts;
72493
72485
  return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */);
72494
72486
  }
72495
72487
  if (isMatchingReference(reference, target)) {
72496
- return narrowByInKeyword(type, leftType, assumeTrue);
72488
+ return narrowTypeByInKeyword(type, leftType, assumeTrue);
72497
72489
  }
72498
72490
  }
72499
72491
  break;
@@ -72682,7 +72674,7 @@ var ts;
72682
72674
  neverType;
72683
72675
  });
72684
72676
  }
72685
- function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
72677
+ function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
72686
72678
  var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement);
72687
72679
  if (!witnesses) {
72688
72680
  return type;
@@ -73072,13 +73064,13 @@ var ts;
73072
73064
  function markAliasReferenced(symbol, location) {
73073
73065
  if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) {
73074
73066
  var target = resolveAlias(symbol);
73075
- if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
73067
+ if (getAllSymbolFlags(target) & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */)) {
73076
73068
  // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled
73077
73069
  // (because the const enum value will not be inlined), or if (2) the alias is an export
73078
73070
  // of a const enum declaration that will be preserved.
73079
73071
  if (compilerOptions.isolatedModules ||
73080
73072
  ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) ||
73081
- !isConstEnumOrConstEnumOnlyModule(target)) {
73073
+ !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) {
73082
73074
  markAliasSymbolAsReferenced(symbol);
73083
73075
  }
73084
73076
  else {
@@ -83049,7 +83041,7 @@ var ts;
83049
83041
  // We only need `Awaited<T>` if `T` is a type variable that has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
83050
83042
  // or is promise-like.
83051
83043
  if (baseConstraint ?
83052
- baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) :
83044
+ baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) :
83053
83045
  maybeTypeOfKind(type, 8650752 /* TypeFlags.TypeVariable */)) {
83054
83046
  return true;
83055
83047
  }
@@ -107395,7 +107387,7 @@ var ts;
107395
107387
  return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis);
107396
107388
  case ts.ModuleKind.CommonJS:
107397
107389
  default:
107398
- return createImportCallExpressionCommonJS(argument, containsLexicalThis);
107390
+ return createImportCallExpressionCommonJS(argument);
107399
107391
  }
107400
107392
  }
107401
107393
  function createImportCallExpressionUMD(arg, containsLexicalThis) {
@@ -107418,7 +107410,7 @@ var ts;
107418
107410
  return factory.createConditionalExpression(
107419
107411
  /*condition*/ factory.createIdentifier("__syncRequire"),
107420
107412
  /*questionToken*/ undefined,
107421
- /*whenTrue*/ createImportCallExpressionCommonJS(arg, containsLexicalThis),
107413
+ /*whenTrue*/ createImportCallExpressionCommonJS(arg),
107422
107414
  /*colonToken*/ undefined,
107423
107415
  /*whenFalse*/ createImportCallExpressionAMD(argClone, containsLexicalThis));
107424
107416
  }
@@ -107427,7 +107419,7 @@ var ts;
107427
107419
  return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression(
107428
107420
  /*condition*/ factory.createIdentifier("__syncRequire"),
107429
107421
  /*questionToken*/ undefined,
107430
- /*whenTrue*/ createImportCallExpressionCommonJS(temp, containsLexicalThis),
107422
+ /*whenTrue*/ createImportCallExpressionCommonJS(temp, /* isInlineable */ true),
107431
107423
  /*colonToken*/ undefined,
107432
107424
  /*whenFalse*/ createImportCallExpressionAMD(temp, containsLexicalThis)));
107433
107425
  }
@@ -107477,14 +107469,20 @@ var ts;
107477
107469
  }
107478
107470
  return promise;
107479
107471
  }
107480
- function createImportCallExpressionCommonJS(arg, containsLexicalThis) {
107481
- // import("./blah")
107472
+ function createImportCallExpressionCommonJS(arg, isInlineable) {
107473
+ // import(x)
107482
107474
  // emit as
107483
- // Promise.resolve().then(function () { return require(x); }) /*CommonJs Require*/
107475
+ // var _a;
107476
+ // (_a = x, Promise.resolve().then(() => require(_a)) /*CommonJs Require*/
107484
107477
  // We have to wrap require in then callback so that require is done in asynchronously
107485
107478
  // if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately
107486
- var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []);
107487
- var requireCall = factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []);
107479
+ // If the arg is not inlineable, we have to evaluate it in the current scope with a temp var
107480
+ var temp = arg && !ts.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined;
107481
+ var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"),
107482
+ /*typeArguments*/ undefined,
107483
+ /*argumentsArray*/ []);
107484
+ var requireCall = factory.createCallExpression(factory.createIdentifier("require"),
107485
+ /*typeArguments*/ undefined, temp ? [temp] : arg ? [arg] : []);
107488
107486
  if (ts.getESModuleInterop(compilerOptions)) {
107489
107487
  requireCall = emitHelpers().createImportStarHelper(requireCall);
107490
107488
  }
@@ -107505,14 +107503,9 @@ var ts;
107505
107503
  /*typeParameters*/ undefined,
107506
107504
  /*parameters*/ [],
107507
107505
  /*type*/ undefined, factory.createBlock([factory.createReturnStatement(requireCall)]));
107508
- // if there is a lexical 'this' in the import call arguments, ensure we indicate
107509
- // that this new function expression indicates it captures 'this' so that the
107510
- // es2015 transformer will properly substitute 'this' with '_this'.
107511
- if (containsLexicalThis) {
107512
- ts.setEmitFlags(func, 8 /* EmitFlags.CapturesThis */);
107513
- }
107514
107506
  }
107515
- return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
107507
+ var downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
107508
+ return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]);
107516
107509
  }
107517
107510
  function getHelperExpressionForExport(node, innerExpr) {
107518
107511
  if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864 /* EmitFlags.NeverApplyImportHelper */) {
@@ -142736,6 +142729,12 @@ var ts;
142736
142729
  var label = ts.getTargetLabel(node.parent, node.text);
142737
142730
  return label ? [createDefinitionInfoFromName(typeChecker, label, "label" /* ScriptElementKind.label */, node.text, /*containerName*/ undefined)] : undefined; // TODO: GH#18217
142738
142731
  }
142732
+ if (node.kind === 105 /* SyntaxKind.ReturnKeyword */) {
142733
+ var functionDeclaration = ts.findAncestor(node.parent, function (n) {
142734
+ return ts.isClassStaticBlockDeclaration(n) ? "quit" : ts.isFunctionLikeDeclaration(n);
142735
+ });
142736
+ return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : undefined;
142737
+ }
142739
142738
  if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
142740
142739
  var classDecl = node.parent.parent;
142741
142740
  var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
@@ -108,7 +108,7 @@ var ts;
108
108
  // The following is baselined as a literal template type without intervention
109
109
  /** The version of the TypeScript compiler release */
110
110
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
111
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221018");
111
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221020");
112
112
  /* @internal */
113
113
  var Comparison;
114
114
  (function (Comparison) {
@@ -21719,13 +21719,11 @@ var ts;
21719
21719
  * Creates a `BaseNodeFactory` which can be used to create `Node` instances from the constructors provided by the object allocator.
21720
21720
  */
21721
21721
  function createBaseNodeFactory() {
21722
- // tslint:disable variable-name
21723
21722
  var NodeConstructor;
21724
21723
  var TokenConstructor;
21725
21724
  var IdentifierConstructor;
21726
21725
  var PrivateIdentifierConstructor;
21727
21726
  var SourceFileConstructor;
21728
- // tslint:enable variable-name
21729
21727
  return {
21730
21728
  createBaseSourceFileNode: createBaseSourceFileNode,
21731
21729
  createBaseIdentifierNode: createBaseIdentifierNode,
@@ -27657,11 +27655,9 @@ var ts;
27657
27655
  rawTextScanner.setText("`" + rawText + "`");
27658
27656
  break;
27659
27657
  case 15 /* SyntaxKind.TemplateHead */:
27660
- // tslint:disable-next-line no-invalid-template-strings
27661
27658
  rawTextScanner.setText("`" + rawText + "${");
27662
27659
  break;
27663
27660
  case 16 /* SyntaxKind.TemplateMiddle */:
27664
- // tslint:disable-next-line no-invalid-template-strings
27665
27661
  rawTextScanner.setText("}" + rawText + "${");
27666
27662
  break;
27667
27663
  case 17 /* SyntaxKind.TemplateTail */:
@@ -28020,7 +28016,6 @@ var ts;
28020
28016
  return node;
28021
28017
  }
28022
28018
  ts.createInputFiles = createInputFiles;
28023
- // tslint:disable-next-line variable-name
28024
28019
  var SourceMapSource;
28025
28020
  /**
28026
28021
  * Create an external source map source file reference
@@ -32154,13 +32149,11 @@ var ts;
32154
32149
  var scanner = ts.createScanner(99 /* ScriptTarget.Latest */, /*skipTrivia*/ true);
32155
32150
  var disallowInAndDecoratorContext = 4096 /* NodeFlags.DisallowInContext */ | 16384 /* NodeFlags.DecoratorContext */;
32156
32151
  // capture constructors in 'initializeState' to avoid null checks
32157
- // tslint:disable variable-name
32158
32152
  var NodeConstructor;
32159
32153
  var TokenConstructor;
32160
32154
  var IdentifierConstructor;
32161
32155
  var PrivateIdentifierConstructor;
32162
32156
  var SourceFileConstructor;
32163
- // tslint:enable variable-name
32164
32157
  function countNode(node) {
32165
32158
  nodeCount++;
32166
32159
  return node;
@@ -67008,7 +67001,7 @@ var ts;
67008
67001
  // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
67009
67002
  if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) {
67010
67003
  var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
67011
- if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
67004
+ if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
67012
67005
  // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
67013
67006
  result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
67014
67007
  }
@@ -68897,8 +68890,7 @@ var ts;
68897
68890
  return !!(type.flags & 109440 /* TypeFlags.Unit */);
68898
68891
  }
68899
68892
  function isUnitLikeType(type) {
68900
- return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.some(type.types, isUnitType) :
68901
- !!(type.flags & 109440 /* TypeFlags.Unit */);
68893
+ return isUnitType(getBaseConstraintOrType(type));
68902
68894
  }
68903
68895
  function extractUnitType(type) {
68904
68896
  return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.find(type.types, isUnitType) || type : type;
@@ -72130,7 +72122,7 @@ var ts;
72130
72122
  type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
72131
72123
  }
72132
72124
  else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
72133
- type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
72125
+ type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
72134
72126
  }
72135
72127
  else {
72136
72128
  if (strictNullChecks) {
@@ -72411,7 +72403,7 @@ var ts;
72411
72403
  !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
72412
72404
  !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
72413
72405
  }
72414
- function narrowByInKeyword(type, nameType, assumeTrue) {
72406
+ function narrowTypeByInKeyword(type, nameType, assumeTrue) {
72415
72407
  var name = getPropertyNameFromType(nameType);
72416
72408
  var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
72417
72409
  if (isKnownProperty) {
@@ -72492,7 +72484,7 @@ var ts;
72492
72484
  return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */);
72493
72485
  }
72494
72486
  if (isMatchingReference(reference, target)) {
72495
- return narrowByInKeyword(type, leftType, assumeTrue);
72487
+ return narrowTypeByInKeyword(type, leftType, assumeTrue);
72496
72488
  }
72497
72489
  }
72498
72490
  break;
@@ -72681,7 +72673,7 @@ var ts;
72681
72673
  neverType;
72682
72674
  });
72683
72675
  }
72684
- function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
72676
+ function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
72685
72677
  var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement);
72686
72678
  if (!witnesses) {
72687
72679
  return type;
@@ -73071,13 +73063,13 @@ var ts;
73071
73063
  function markAliasReferenced(symbol, location) {
73072
73064
  if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) {
73073
73065
  var target = resolveAlias(symbol);
73074
- if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
73066
+ if (getAllSymbolFlags(target) & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */)) {
73075
73067
  // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled
73076
73068
  // (because the const enum value will not be inlined), or if (2) the alias is an export
73077
73069
  // of a const enum declaration that will be preserved.
73078
73070
  if (compilerOptions.isolatedModules ||
73079
73071
  ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) ||
73080
- !isConstEnumOrConstEnumOnlyModule(target)) {
73072
+ !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) {
73081
73073
  markAliasSymbolAsReferenced(symbol);
73082
73074
  }
73083
73075
  else {
@@ -83048,7 +83040,7 @@ var ts;
83048
83040
  // We only need `Awaited<T>` if `T` is a type variable that has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
83049
83041
  // or is promise-like.
83050
83042
  if (baseConstraint ?
83051
- baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) :
83043
+ baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) :
83052
83044
  maybeTypeOfKind(type, 8650752 /* TypeFlags.TypeVariable */)) {
83053
83045
  return true;
83054
83046
  }
@@ -107394,7 +107386,7 @@ var ts;
107394
107386
  return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis);
107395
107387
  case ts.ModuleKind.CommonJS:
107396
107388
  default:
107397
- return createImportCallExpressionCommonJS(argument, containsLexicalThis);
107389
+ return createImportCallExpressionCommonJS(argument);
107398
107390
  }
107399
107391
  }
107400
107392
  function createImportCallExpressionUMD(arg, containsLexicalThis) {
@@ -107417,7 +107409,7 @@ var ts;
107417
107409
  return factory.createConditionalExpression(
107418
107410
  /*condition*/ factory.createIdentifier("__syncRequire"),
107419
107411
  /*questionToken*/ undefined,
107420
- /*whenTrue*/ createImportCallExpressionCommonJS(arg, containsLexicalThis),
107412
+ /*whenTrue*/ createImportCallExpressionCommonJS(arg),
107421
107413
  /*colonToken*/ undefined,
107422
107414
  /*whenFalse*/ createImportCallExpressionAMD(argClone, containsLexicalThis));
107423
107415
  }
@@ -107426,7 +107418,7 @@ var ts;
107426
107418
  return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression(
107427
107419
  /*condition*/ factory.createIdentifier("__syncRequire"),
107428
107420
  /*questionToken*/ undefined,
107429
- /*whenTrue*/ createImportCallExpressionCommonJS(temp, containsLexicalThis),
107421
+ /*whenTrue*/ createImportCallExpressionCommonJS(temp, /* isInlineable */ true),
107430
107422
  /*colonToken*/ undefined,
107431
107423
  /*whenFalse*/ createImportCallExpressionAMD(temp, containsLexicalThis)));
107432
107424
  }
@@ -107476,14 +107468,20 @@ var ts;
107476
107468
  }
107477
107469
  return promise;
107478
107470
  }
107479
- function createImportCallExpressionCommonJS(arg, containsLexicalThis) {
107480
- // import("./blah")
107471
+ function createImportCallExpressionCommonJS(arg, isInlineable) {
107472
+ // import(x)
107481
107473
  // emit as
107482
- // Promise.resolve().then(function () { return require(x); }) /*CommonJs Require*/
107474
+ // var _a;
107475
+ // (_a = x, Promise.resolve().then(() => require(_a)) /*CommonJs Require*/
107483
107476
  // We have to wrap require in then callback so that require is done in asynchronously
107484
107477
  // if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately
107485
- var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []);
107486
- var requireCall = factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []);
107478
+ // If the arg is not inlineable, we have to evaluate it in the current scope with a temp var
107479
+ var temp = arg && !ts.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined;
107480
+ var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"),
107481
+ /*typeArguments*/ undefined,
107482
+ /*argumentsArray*/ []);
107483
+ var requireCall = factory.createCallExpression(factory.createIdentifier("require"),
107484
+ /*typeArguments*/ undefined, temp ? [temp] : arg ? [arg] : []);
107487
107485
  if (ts.getESModuleInterop(compilerOptions)) {
107488
107486
  requireCall = emitHelpers().createImportStarHelper(requireCall);
107489
107487
  }
@@ -107504,14 +107502,9 @@ var ts;
107504
107502
  /*typeParameters*/ undefined,
107505
107503
  /*parameters*/ [],
107506
107504
  /*type*/ undefined, factory.createBlock([factory.createReturnStatement(requireCall)]));
107507
- // if there is a lexical 'this' in the import call arguments, ensure we indicate
107508
- // that this new function expression indicates it captures 'this' so that the
107509
- // es2015 transformer will properly substitute 'this' with '_this'.
107510
- if (containsLexicalThis) {
107511
- ts.setEmitFlags(func, 8 /* EmitFlags.CapturesThis */);
107512
- }
107513
107505
  }
107514
- return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
107506
+ var downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
107507
+ return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]);
107515
107508
  }
107516
107509
  function getHelperExpressionForExport(node, innerExpr) {
107517
107510
  if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864 /* EmitFlags.NeverApplyImportHelper */) {
@@ -143154,6 +143147,12 @@ var ts;
143154
143147
  var label = ts.getTargetLabel(node.parent, node.text);
143155
143148
  return label ? [createDefinitionInfoFromName(typeChecker, label, "label" /* ScriptElementKind.label */, node.text, /*containerName*/ undefined)] : undefined; // TODO: GH#18217
143156
143149
  }
143150
+ if (node.kind === 105 /* SyntaxKind.ReturnKeyword */) {
143151
+ var functionDeclaration = ts.findAncestor(node.parent, function (n) {
143152
+ return ts.isClassStaticBlockDeclaration(n) ? "quit" : ts.isFunctionLikeDeclaration(n);
143153
+ });
143154
+ return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : undefined;
143155
+ }
143157
143156
  if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
143158
143157
  var classDecl = node.parent.parent;
143159
143158
  var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
package/lib/typescript.js CHANGED
@@ -99,7 +99,7 @@ var ts;
99
99
  // The following is baselined as a literal template type without intervention
100
100
  /** The version of the TypeScript compiler release */
101
101
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
102
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221018");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221020");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -21710,13 +21710,11 @@ var ts;
21710
21710
  * Creates a `BaseNodeFactory` which can be used to create `Node` instances from the constructors provided by the object allocator.
21711
21711
  */
21712
21712
  function createBaseNodeFactory() {
21713
- // tslint:disable variable-name
21714
21713
  var NodeConstructor;
21715
21714
  var TokenConstructor;
21716
21715
  var IdentifierConstructor;
21717
21716
  var PrivateIdentifierConstructor;
21718
21717
  var SourceFileConstructor;
21719
- // tslint:enable variable-name
21720
21718
  return {
21721
21719
  createBaseSourceFileNode: createBaseSourceFileNode,
21722
21720
  createBaseIdentifierNode: createBaseIdentifierNode,
@@ -27648,11 +27646,9 @@ var ts;
27648
27646
  rawTextScanner.setText("`" + rawText + "`");
27649
27647
  break;
27650
27648
  case 15 /* SyntaxKind.TemplateHead */:
27651
- // tslint:disable-next-line no-invalid-template-strings
27652
27649
  rawTextScanner.setText("`" + rawText + "${");
27653
27650
  break;
27654
27651
  case 16 /* SyntaxKind.TemplateMiddle */:
27655
- // tslint:disable-next-line no-invalid-template-strings
27656
27652
  rawTextScanner.setText("}" + rawText + "${");
27657
27653
  break;
27658
27654
  case 17 /* SyntaxKind.TemplateTail */:
@@ -28011,7 +28007,6 @@ var ts;
28011
28007
  return node;
28012
28008
  }
28013
28009
  ts.createInputFiles = createInputFiles;
28014
- // tslint:disable-next-line variable-name
28015
28010
  var SourceMapSource;
28016
28011
  /**
28017
28012
  * Create an external source map source file reference
@@ -32145,13 +32140,11 @@ var ts;
32145
32140
  var scanner = ts.createScanner(99 /* ScriptTarget.Latest */, /*skipTrivia*/ true);
32146
32141
  var disallowInAndDecoratorContext = 4096 /* NodeFlags.DisallowInContext */ | 16384 /* NodeFlags.DecoratorContext */;
32147
32142
  // capture constructors in 'initializeState' to avoid null checks
32148
- // tslint:disable variable-name
32149
32143
  var NodeConstructor;
32150
32144
  var TokenConstructor;
32151
32145
  var IdentifierConstructor;
32152
32146
  var PrivateIdentifierConstructor;
32153
32147
  var SourceFileConstructor;
32154
- // tslint:enable variable-name
32155
32148
  function countNode(node) {
32156
32149
  nodeCount++;
32157
32150
  return node;
@@ -66999,7 +66992,7 @@ var ts;
66999
66992
  // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
67000
66993
  if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) {
67001
66994
  var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
67002
- if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66995
+ if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
67003
66996
  // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
67004
66997
  result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
67005
66998
  }
@@ -68888,8 +68881,7 @@ var ts;
68888
68881
  return !!(type.flags & 109440 /* TypeFlags.Unit */);
68889
68882
  }
68890
68883
  function isUnitLikeType(type) {
68891
- return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.some(type.types, isUnitType) :
68892
- !!(type.flags & 109440 /* TypeFlags.Unit */);
68884
+ return isUnitType(getBaseConstraintOrType(type));
68893
68885
  }
68894
68886
  function extractUnitType(type) {
68895
68887
  return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.find(type.types, isUnitType) || type : type;
@@ -72121,7 +72113,7 @@ var ts;
72121
72113
  type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
72122
72114
  }
72123
72115
  else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
72124
- type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
72116
+ type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
72125
72117
  }
72126
72118
  else {
72127
72119
  if (strictNullChecks) {
@@ -72402,7 +72394,7 @@ var ts;
72402
72394
  !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
72403
72395
  !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
72404
72396
  }
72405
- function narrowByInKeyword(type, nameType, assumeTrue) {
72397
+ function narrowTypeByInKeyword(type, nameType, assumeTrue) {
72406
72398
  var name = getPropertyNameFromType(nameType);
72407
72399
  var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
72408
72400
  if (isKnownProperty) {
@@ -72483,7 +72475,7 @@ var ts;
72483
72475
  return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */);
72484
72476
  }
72485
72477
  if (isMatchingReference(reference, target)) {
72486
- return narrowByInKeyword(type, leftType, assumeTrue);
72478
+ return narrowTypeByInKeyword(type, leftType, assumeTrue);
72487
72479
  }
72488
72480
  }
72489
72481
  break;
@@ -72672,7 +72664,7 @@ var ts;
72672
72664
  neverType;
72673
72665
  });
72674
72666
  }
72675
- function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
72667
+ function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
72676
72668
  var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement);
72677
72669
  if (!witnesses) {
72678
72670
  return type;
@@ -73062,13 +73054,13 @@ var ts;
73062
73054
  function markAliasReferenced(symbol, location) {
73063
73055
  if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) {
73064
73056
  var target = resolveAlias(symbol);
73065
- if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
73057
+ if (getAllSymbolFlags(target) & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */)) {
73066
73058
  // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled
73067
73059
  // (because the const enum value will not be inlined), or if (2) the alias is an export
73068
73060
  // of a const enum declaration that will be preserved.
73069
73061
  if (compilerOptions.isolatedModules ||
73070
73062
  ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) ||
73071
- !isConstEnumOrConstEnumOnlyModule(target)) {
73063
+ !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) {
73072
73064
  markAliasSymbolAsReferenced(symbol);
73073
73065
  }
73074
73066
  else {
@@ -83039,7 +83031,7 @@ var ts;
83039
83031
  // We only need `Awaited<T>` if `T` is a type variable that has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
83040
83032
  // or is promise-like.
83041
83033
  if (baseConstraint ?
83042
- baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) :
83034
+ baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) :
83043
83035
  maybeTypeOfKind(type, 8650752 /* TypeFlags.TypeVariable */)) {
83044
83036
  return true;
83045
83037
  }
@@ -107385,7 +107377,7 @@ var ts;
107385
107377
  return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis);
107386
107378
  case ts.ModuleKind.CommonJS:
107387
107379
  default:
107388
- return createImportCallExpressionCommonJS(argument, containsLexicalThis);
107380
+ return createImportCallExpressionCommonJS(argument);
107389
107381
  }
107390
107382
  }
107391
107383
  function createImportCallExpressionUMD(arg, containsLexicalThis) {
@@ -107408,7 +107400,7 @@ var ts;
107408
107400
  return factory.createConditionalExpression(
107409
107401
  /*condition*/ factory.createIdentifier("__syncRequire"),
107410
107402
  /*questionToken*/ undefined,
107411
- /*whenTrue*/ createImportCallExpressionCommonJS(arg, containsLexicalThis),
107403
+ /*whenTrue*/ createImportCallExpressionCommonJS(arg),
107412
107404
  /*colonToken*/ undefined,
107413
107405
  /*whenFalse*/ createImportCallExpressionAMD(argClone, containsLexicalThis));
107414
107406
  }
@@ -107417,7 +107409,7 @@ var ts;
107417
107409
  return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression(
107418
107410
  /*condition*/ factory.createIdentifier("__syncRequire"),
107419
107411
  /*questionToken*/ undefined,
107420
- /*whenTrue*/ createImportCallExpressionCommonJS(temp, containsLexicalThis),
107412
+ /*whenTrue*/ createImportCallExpressionCommonJS(temp, /* isInlineable */ true),
107421
107413
  /*colonToken*/ undefined,
107422
107414
  /*whenFalse*/ createImportCallExpressionAMD(temp, containsLexicalThis)));
107423
107415
  }
@@ -107467,14 +107459,20 @@ var ts;
107467
107459
  }
107468
107460
  return promise;
107469
107461
  }
107470
- function createImportCallExpressionCommonJS(arg, containsLexicalThis) {
107471
- // import("./blah")
107462
+ function createImportCallExpressionCommonJS(arg, isInlineable) {
107463
+ // import(x)
107472
107464
  // emit as
107473
- // Promise.resolve().then(function () { return require(x); }) /*CommonJs Require*/
107465
+ // var _a;
107466
+ // (_a = x, Promise.resolve().then(() => require(_a)) /*CommonJs Require*/
107474
107467
  // We have to wrap require in then callback so that require is done in asynchronously
107475
107468
  // if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately
107476
- var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []);
107477
- var requireCall = factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []);
107469
+ // If the arg is not inlineable, we have to evaluate it in the current scope with a temp var
107470
+ var temp = arg && !ts.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined;
107471
+ var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"),
107472
+ /*typeArguments*/ undefined,
107473
+ /*argumentsArray*/ []);
107474
+ var requireCall = factory.createCallExpression(factory.createIdentifier("require"),
107475
+ /*typeArguments*/ undefined, temp ? [temp] : arg ? [arg] : []);
107478
107476
  if (ts.getESModuleInterop(compilerOptions)) {
107479
107477
  requireCall = emitHelpers().createImportStarHelper(requireCall);
107480
107478
  }
@@ -107495,14 +107493,9 @@ var ts;
107495
107493
  /*typeParameters*/ undefined,
107496
107494
  /*parameters*/ [],
107497
107495
  /*type*/ undefined, factory.createBlock([factory.createReturnStatement(requireCall)]));
107498
- // if there is a lexical 'this' in the import call arguments, ensure we indicate
107499
- // that this new function expression indicates it captures 'this' so that the
107500
- // es2015 transformer will properly substitute 'this' with '_this'.
107501
- if (containsLexicalThis) {
107502
- ts.setEmitFlags(func, 8 /* EmitFlags.CapturesThis */);
107503
- }
107504
107496
  }
107505
- return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
107497
+ var downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
107498
+ return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]);
107506
107499
  }
107507
107500
  function getHelperExpressionForExport(node, innerExpr) {
107508
107501
  if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864 /* EmitFlags.NeverApplyImportHelper */) {
@@ -143145,6 +143138,12 @@ var ts;
143145
143138
  var label = ts.getTargetLabel(node.parent, node.text);
143146
143139
  return label ? [createDefinitionInfoFromName(typeChecker, label, "label" /* ScriptElementKind.label */, node.text, /*containerName*/ undefined)] : undefined; // TODO: GH#18217
143147
143140
  }
143141
+ if (node.kind === 105 /* SyntaxKind.ReturnKeyword */) {
143142
+ var functionDeclaration = ts.findAncestor(node.parent, function (n) {
143143
+ return ts.isClassStaticBlockDeclaration(n) ? "quit" : ts.isFunctionLikeDeclaration(n);
143144
+ });
143145
+ return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : undefined;
143146
+ }
143148
143147
  if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
143149
143148
  var classDecl = node.parent.parent;
143150
143149
  var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
@@ -99,7 +99,7 @@ var ts;
99
99
  // The following is baselined as a literal template type without intervention
100
100
  /** The version of the TypeScript compiler release */
101
101
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
102
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221018");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221020");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -21710,13 +21710,11 @@ var ts;
21710
21710
  * Creates a `BaseNodeFactory` which can be used to create `Node` instances from the constructors provided by the object allocator.
21711
21711
  */
21712
21712
  function createBaseNodeFactory() {
21713
- // tslint:disable variable-name
21714
21713
  var NodeConstructor;
21715
21714
  var TokenConstructor;
21716
21715
  var IdentifierConstructor;
21717
21716
  var PrivateIdentifierConstructor;
21718
21717
  var SourceFileConstructor;
21719
- // tslint:enable variable-name
21720
21718
  return {
21721
21719
  createBaseSourceFileNode: createBaseSourceFileNode,
21722
21720
  createBaseIdentifierNode: createBaseIdentifierNode,
@@ -27648,11 +27646,9 @@ var ts;
27648
27646
  rawTextScanner.setText("`" + rawText + "`");
27649
27647
  break;
27650
27648
  case 15 /* SyntaxKind.TemplateHead */:
27651
- // tslint:disable-next-line no-invalid-template-strings
27652
27649
  rawTextScanner.setText("`" + rawText + "${");
27653
27650
  break;
27654
27651
  case 16 /* SyntaxKind.TemplateMiddle */:
27655
- // tslint:disable-next-line no-invalid-template-strings
27656
27652
  rawTextScanner.setText("}" + rawText + "${");
27657
27653
  break;
27658
27654
  case 17 /* SyntaxKind.TemplateTail */:
@@ -28011,7 +28007,6 @@ var ts;
28011
28007
  return node;
28012
28008
  }
28013
28009
  ts.createInputFiles = createInputFiles;
28014
- // tslint:disable-next-line variable-name
28015
28010
  var SourceMapSource;
28016
28011
  /**
28017
28012
  * Create an external source map source file reference
@@ -32145,13 +32140,11 @@ var ts;
32145
32140
  var scanner = ts.createScanner(99 /* ScriptTarget.Latest */, /*skipTrivia*/ true);
32146
32141
  var disallowInAndDecoratorContext = 4096 /* NodeFlags.DisallowInContext */ | 16384 /* NodeFlags.DecoratorContext */;
32147
32142
  // capture constructors in 'initializeState' to avoid null checks
32148
- // tslint:disable variable-name
32149
32143
  var NodeConstructor;
32150
32144
  var TokenConstructor;
32151
32145
  var IdentifierConstructor;
32152
32146
  var PrivateIdentifierConstructor;
32153
32147
  var SourceFileConstructor;
32154
- // tslint:enable variable-name
32155
32148
  function countNode(node) {
32156
32149
  nodeCount++;
32157
32150
  return node;
@@ -66999,7 +66992,7 @@ var ts;
66999
66992
  // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
67000
66993
  if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) {
67001
66994
  var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
67002
- if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66995
+ if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
67003
66996
  // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
67004
66997
  result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
67005
66998
  }
@@ -68888,8 +68881,7 @@ var ts;
68888
68881
  return !!(type.flags & 109440 /* TypeFlags.Unit */);
68889
68882
  }
68890
68883
  function isUnitLikeType(type) {
68891
- return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.some(type.types, isUnitType) :
68892
- !!(type.flags & 109440 /* TypeFlags.Unit */);
68884
+ return isUnitType(getBaseConstraintOrType(type));
68893
68885
  }
68894
68886
  function extractUnitType(type) {
68895
68887
  return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.find(type.types, isUnitType) || type : type;
@@ -72121,7 +72113,7 @@ var ts;
72121
72113
  type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
72122
72114
  }
72123
72115
  else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
72124
- type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
72116
+ type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
72125
72117
  }
72126
72118
  else {
72127
72119
  if (strictNullChecks) {
@@ -72402,7 +72394,7 @@ var ts;
72402
72394
  !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
72403
72395
  !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
72404
72396
  }
72405
- function narrowByInKeyword(type, nameType, assumeTrue) {
72397
+ function narrowTypeByInKeyword(type, nameType, assumeTrue) {
72406
72398
  var name = getPropertyNameFromType(nameType);
72407
72399
  var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
72408
72400
  if (isKnownProperty) {
@@ -72483,7 +72475,7 @@ var ts;
72483
72475
  return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */);
72484
72476
  }
72485
72477
  if (isMatchingReference(reference, target)) {
72486
- return narrowByInKeyword(type, leftType, assumeTrue);
72478
+ return narrowTypeByInKeyword(type, leftType, assumeTrue);
72487
72479
  }
72488
72480
  }
72489
72481
  break;
@@ -72672,7 +72664,7 @@ var ts;
72672
72664
  neverType;
72673
72665
  });
72674
72666
  }
72675
- function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
72667
+ function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
72676
72668
  var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement);
72677
72669
  if (!witnesses) {
72678
72670
  return type;
@@ -73062,13 +73054,13 @@ var ts;
73062
73054
  function markAliasReferenced(symbol, location) {
73063
73055
  if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) {
73064
73056
  var target = resolveAlias(symbol);
73065
- if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
73057
+ if (getAllSymbolFlags(target) & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */)) {
73066
73058
  // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled
73067
73059
  // (because the const enum value will not be inlined), or if (2) the alias is an export
73068
73060
  // of a const enum declaration that will be preserved.
73069
73061
  if (compilerOptions.isolatedModules ||
73070
73062
  ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) ||
73071
- !isConstEnumOrConstEnumOnlyModule(target)) {
73063
+ !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) {
73072
73064
  markAliasSymbolAsReferenced(symbol);
73073
73065
  }
73074
73066
  else {
@@ -83039,7 +83031,7 @@ var ts;
83039
83031
  // We only need `Awaited<T>` if `T` is a type variable that has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
83040
83032
  // or is promise-like.
83041
83033
  if (baseConstraint ?
83042
- baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) :
83034
+ baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) :
83043
83035
  maybeTypeOfKind(type, 8650752 /* TypeFlags.TypeVariable */)) {
83044
83036
  return true;
83045
83037
  }
@@ -107385,7 +107377,7 @@ var ts;
107385
107377
  return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis);
107386
107378
  case ts.ModuleKind.CommonJS:
107387
107379
  default:
107388
- return createImportCallExpressionCommonJS(argument, containsLexicalThis);
107380
+ return createImportCallExpressionCommonJS(argument);
107389
107381
  }
107390
107382
  }
107391
107383
  function createImportCallExpressionUMD(arg, containsLexicalThis) {
@@ -107408,7 +107400,7 @@ var ts;
107408
107400
  return factory.createConditionalExpression(
107409
107401
  /*condition*/ factory.createIdentifier("__syncRequire"),
107410
107402
  /*questionToken*/ undefined,
107411
- /*whenTrue*/ createImportCallExpressionCommonJS(arg, containsLexicalThis),
107403
+ /*whenTrue*/ createImportCallExpressionCommonJS(arg),
107412
107404
  /*colonToken*/ undefined,
107413
107405
  /*whenFalse*/ createImportCallExpressionAMD(argClone, containsLexicalThis));
107414
107406
  }
@@ -107417,7 +107409,7 @@ var ts;
107417
107409
  return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression(
107418
107410
  /*condition*/ factory.createIdentifier("__syncRequire"),
107419
107411
  /*questionToken*/ undefined,
107420
- /*whenTrue*/ createImportCallExpressionCommonJS(temp, containsLexicalThis),
107412
+ /*whenTrue*/ createImportCallExpressionCommonJS(temp, /* isInlineable */ true),
107421
107413
  /*colonToken*/ undefined,
107422
107414
  /*whenFalse*/ createImportCallExpressionAMD(temp, containsLexicalThis)));
107423
107415
  }
@@ -107467,14 +107459,20 @@ var ts;
107467
107459
  }
107468
107460
  return promise;
107469
107461
  }
107470
- function createImportCallExpressionCommonJS(arg, containsLexicalThis) {
107471
- // import("./blah")
107462
+ function createImportCallExpressionCommonJS(arg, isInlineable) {
107463
+ // import(x)
107472
107464
  // emit as
107473
- // Promise.resolve().then(function () { return require(x); }) /*CommonJs Require*/
107465
+ // var _a;
107466
+ // (_a = x, Promise.resolve().then(() => require(_a)) /*CommonJs Require*/
107474
107467
  // We have to wrap require in then callback so that require is done in asynchronously
107475
107468
  // if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately
107476
- var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []);
107477
- var requireCall = factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []);
107469
+ // If the arg is not inlineable, we have to evaluate it in the current scope with a temp var
107470
+ var temp = arg && !ts.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined;
107471
+ var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"),
107472
+ /*typeArguments*/ undefined,
107473
+ /*argumentsArray*/ []);
107474
+ var requireCall = factory.createCallExpression(factory.createIdentifier("require"),
107475
+ /*typeArguments*/ undefined, temp ? [temp] : arg ? [arg] : []);
107478
107476
  if (ts.getESModuleInterop(compilerOptions)) {
107479
107477
  requireCall = emitHelpers().createImportStarHelper(requireCall);
107480
107478
  }
@@ -107495,14 +107493,9 @@ var ts;
107495
107493
  /*typeParameters*/ undefined,
107496
107494
  /*parameters*/ [],
107497
107495
  /*type*/ undefined, factory.createBlock([factory.createReturnStatement(requireCall)]));
107498
- // if there is a lexical 'this' in the import call arguments, ensure we indicate
107499
- // that this new function expression indicates it captures 'this' so that the
107500
- // es2015 transformer will properly substitute 'this' with '_this'.
107501
- if (containsLexicalThis) {
107502
- ts.setEmitFlags(func, 8 /* EmitFlags.CapturesThis */);
107503
- }
107504
107496
  }
107505
- return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
107497
+ var downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
107498
+ return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]);
107506
107499
  }
107507
107500
  function getHelperExpressionForExport(node, innerExpr) {
107508
107501
  if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864 /* EmitFlags.NeverApplyImportHelper */) {
@@ -143145,6 +143138,12 @@ var ts;
143145
143138
  var label = ts.getTargetLabel(node.parent, node.text);
143146
143139
  return label ? [createDefinitionInfoFromName(typeChecker, label, "label" /* ScriptElementKind.label */, node.text, /*containerName*/ undefined)] : undefined; // TODO: GH#18217
143147
143140
  }
143141
+ if (node.kind === 105 /* SyntaxKind.ReturnKeyword */) {
143142
+ var functionDeclaration = ts.findAncestor(node.parent, function (n) {
143143
+ return ts.isClassStaticBlockDeclaration(n) ? "quit" : ts.isFunctionLikeDeclaration(n);
143144
+ });
143145
+ return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : undefined;
143146
+ }
143148
143147
  if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
143149
143148
  var classDecl = node.parent.parent;
143150
143149
  var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221018");
92
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221020");
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -21700,13 +21700,11 @@ var ts;
21700
21700
  * Creates a `BaseNodeFactory` which can be used to create `Node` instances from the constructors provided by the object allocator.
21701
21701
  */
21702
21702
  function createBaseNodeFactory() {
21703
- // tslint:disable variable-name
21704
21703
  var NodeConstructor;
21705
21704
  var TokenConstructor;
21706
21705
  var IdentifierConstructor;
21707
21706
  var PrivateIdentifierConstructor;
21708
21707
  var SourceFileConstructor;
21709
- // tslint:enable variable-name
21710
21708
  return {
21711
21709
  createBaseSourceFileNode: createBaseSourceFileNode,
21712
21710
  createBaseIdentifierNode: createBaseIdentifierNode,
@@ -27638,11 +27636,9 @@ var ts;
27638
27636
  rawTextScanner.setText("`" + rawText + "`");
27639
27637
  break;
27640
27638
  case 15 /* SyntaxKind.TemplateHead */:
27641
- // tslint:disable-next-line no-invalid-template-strings
27642
27639
  rawTextScanner.setText("`" + rawText + "${");
27643
27640
  break;
27644
27641
  case 16 /* SyntaxKind.TemplateMiddle */:
27645
- // tslint:disable-next-line no-invalid-template-strings
27646
27642
  rawTextScanner.setText("}" + rawText + "${");
27647
27643
  break;
27648
27644
  case 17 /* SyntaxKind.TemplateTail */:
@@ -28001,7 +27997,6 @@ var ts;
28001
27997
  return node;
28002
27998
  }
28003
27999
  ts.createInputFiles = createInputFiles;
28004
- // tslint:disable-next-line variable-name
28005
28000
  var SourceMapSource;
28006
28001
  /**
28007
28002
  * Create an external source map source file reference
@@ -32135,13 +32130,11 @@ var ts;
32135
32130
  var scanner = ts.createScanner(99 /* ScriptTarget.Latest */, /*skipTrivia*/ true);
32136
32131
  var disallowInAndDecoratorContext = 4096 /* NodeFlags.DisallowInContext */ | 16384 /* NodeFlags.DecoratorContext */;
32137
32132
  // capture constructors in 'initializeState' to avoid null checks
32138
- // tslint:disable variable-name
32139
32133
  var NodeConstructor;
32140
32134
  var TokenConstructor;
32141
32135
  var IdentifierConstructor;
32142
32136
  var PrivateIdentifierConstructor;
32143
32137
  var SourceFileConstructor;
32144
- // tslint:enable variable-name
32145
32138
  function countNode(node) {
32146
32139
  nodeCount++;
32147
32140
  return node;
@@ -66989,7 +66982,7 @@ var ts;
66989
66982
  // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
66990
66983
  if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) {
66991
66984
  var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
66992
- if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66985
+ if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66993
66986
  // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66994
66987
  result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
66995
66988
  }
@@ -68878,8 +68871,7 @@ var ts;
68878
68871
  return !!(type.flags & 109440 /* TypeFlags.Unit */);
68879
68872
  }
68880
68873
  function isUnitLikeType(type) {
68881
- return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.some(type.types, isUnitType) :
68882
- !!(type.flags & 109440 /* TypeFlags.Unit */);
68874
+ return isUnitType(getBaseConstraintOrType(type));
68883
68875
  }
68884
68876
  function extractUnitType(type) {
68885
68877
  return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.find(type.types, isUnitType) || type : type;
@@ -72111,7 +72103,7 @@ var ts;
72111
72103
  type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
72112
72104
  }
72113
72105
  else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
72114
- type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
72106
+ type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
72115
72107
  }
72116
72108
  else {
72117
72109
  if (strictNullChecks) {
@@ -72392,7 +72384,7 @@ var ts;
72392
72384
  !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
72393
72385
  !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
72394
72386
  }
72395
- function narrowByInKeyword(type, nameType, assumeTrue) {
72387
+ function narrowTypeByInKeyword(type, nameType, assumeTrue) {
72396
72388
  var name = getPropertyNameFromType(nameType);
72397
72389
  var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
72398
72390
  if (isKnownProperty) {
@@ -72473,7 +72465,7 @@ var ts;
72473
72465
  return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */);
72474
72466
  }
72475
72467
  if (isMatchingReference(reference, target)) {
72476
- return narrowByInKeyword(type, leftType, assumeTrue);
72468
+ return narrowTypeByInKeyword(type, leftType, assumeTrue);
72477
72469
  }
72478
72470
  }
72479
72471
  break;
@@ -72662,7 +72654,7 @@ var ts;
72662
72654
  neverType;
72663
72655
  });
72664
72656
  }
72665
- function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
72657
+ function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
72666
72658
  var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement);
72667
72659
  if (!witnesses) {
72668
72660
  return type;
@@ -73052,13 +73044,13 @@ var ts;
73052
73044
  function markAliasReferenced(symbol, location) {
73053
73045
  if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) {
73054
73046
  var target = resolveAlias(symbol);
73055
- if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
73047
+ if (getAllSymbolFlags(target) & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */)) {
73056
73048
  // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled
73057
73049
  // (because the const enum value will not be inlined), or if (2) the alias is an export
73058
73050
  // of a const enum declaration that will be preserved.
73059
73051
  if (compilerOptions.isolatedModules ||
73060
73052
  ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) ||
73061
- !isConstEnumOrConstEnumOnlyModule(target)) {
73053
+ !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) {
73062
73054
  markAliasSymbolAsReferenced(symbol);
73063
73055
  }
73064
73056
  else {
@@ -83029,7 +83021,7 @@ var ts;
83029
83021
  // We only need `Awaited<T>` if `T` is a type variable that has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
83030
83022
  // or is promise-like.
83031
83023
  if (baseConstraint ?
83032
- baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) :
83024
+ baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) :
83033
83025
  maybeTypeOfKind(type, 8650752 /* TypeFlags.TypeVariable */)) {
83034
83026
  return true;
83035
83027
  }
@@ -107375,7 +107367,7 @@ var ts;
107375
107367
  return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis);
107376
107368
  case ts.ModuleKind.CommonJS:
107377
107369
  default:
107378
- return createImportCallExpressionCommonJS(argument, containsLexicalThis);
107370
+ return createImportCallExpressionCommonJS(argument);
107379
107371
  }
107380
107372
  }
107381
107373
  function createImportCallExpressionUMD(arg, containsLexicalThis) {
@@ -107398,7 +107390,7 @@ var ts;
107398
107390
  return factory.createConditionalExpression(
107399
107391
  /*condition*/ factory.createIdentifier("__syncRequire"),
107400
107392
  /*questionToken*/ undefined,
107401
- /*whenTrue*/ createImportCallExpressionCommonJS(arg, containsLexicalThis),
107393
+ /*whenTrue*/ createImportCallExpressionCommonJS(arg),
107402
107394
  /*colonToken*/ undefined,
107403
107395
  /*whenFalse*/ createImportCallExpressionAMD(argClone, containsLexicalThis));
107404
107396
  }
@@ -107407,7 +107399,7 @@ var ts;
107407
107399
  return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression(
107408
107400
  /*condition*/ factory.createIdentifier("__syncRequire"),
107409
107401
  /*questionToken*/ undefined,
107410
- /*whenTrue*/ createImportCallExpressionCommonJS(temp, containsLexicalThis),
107402
+ /*whenTrue*/ createImportCallExpressionCommonJS(temp, /* isInlineable */ true),
107411
107403
  /*colonToken*/ undefined,
107412
107404
  /*whenFalse*/ createImportCallExpressionAMD(temp, containsLexicalThis)));
107413
107405
  }
@@ -107457,14 +107449,20 @@ var ts;
107457
107449
  }
107458
107450
  return promise;
107459
107451
  }
107460
- function createImportCallExpressionCommonJS(arg, containsLexicalThis) {
107461
- // import("./blah")
107452
+ function createImportCallExpressionCommonJS(arg, isInlineable) {
107453
+ // import(x)
107462
107454
  // emit as
107463
- // Promise.resolve().then(function () { return require(x); }) /*CommonJs Require*/
107455
+ // var _a;
107456
+ // (_a = x, Promise.resolve().then(() => require(_a)) /*CommonJs Require*/
107464
107457
  // We have to wrap require in then callback so that require is done in asynchronously
107465
107458
  // if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately
107466
- var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []);
107467
- var requireCall = factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []);
107459
+ // If the arg is not inlineable, we have to evaluate it in the current scope with a temp var
107460
+ var temp = arg && !ts.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined;
107461
+ var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"),
107462
+ /*typeArguments*/ undefined,
107463
+ /*argumentsArray*/ []);
107464
+ var requireCall = factory.createCallExpression(factory.createIdentifier("require"),
107465
+ /*typeArguments*/ undefined, temp ? [temp] : arg ? [arg] : []);
107468
107466
  if (ts.getESModuleInterop(compilerOptions)) {
107469
107467
  requireCall = emitHelpers().createImportStarHelper(requireCall);
107470
107468
  }
@@ -107485,14 +107483,9 @@ var ts;
107485
107483
  /*typeParameters*/ undefined,
107486
107484
  /*parameters*/ [],
107487
107485
  /*type*/ undefined, factory.createBlock([factory.createReturnStatement(requireCall)]));
107488
- // if there is a lexical 'this' in the import call arguments, ensure we indicate
107489
- // that this new function expression indicates it captures 'this' so that the
107490
- // es2015 transformer will properly substitute 'this' with '_this'.
107491
- if (containsLexicalThis) {
107492
- ts.setEmitFlags(func, 8 /* EmitFlags.CapturesThis */);
107493
- }
107494
107486
  }
107495
- return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
107487
+ var downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
107488
+ return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]);
107496
107489
  }
107497
107490
  function getHelperExpressionForExport(node, innerExpr) {
107498
107491
  if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864 /* EmitFlags.NeverApplyImportHelper */) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.9.0-dev.20221018",
5
+ "version": "4.9.0-dev.20221020",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [