typescript 4.6.0-dev.20220120 → 4.6.0-dev.20220124

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.6";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20220120";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220124";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  function tryGetNativeMap() {
@@ -5911,6 +5911,7 @@ var ts;
5911
5911
  Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path."),
5912
5912
  Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?"),
5913
5913
  Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
5914
+ Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
5914
5915
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
5915
5916
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
5916
5917
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -29109,7 +29110,7 @@ var ts;
29109
29110
  var pos = getNodePos();
29110
29111
  var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10);
29111
29112
  parseExpected(58);
29112
- var value = parseLiteralLikeNode(10);
29113
+ var value = parseAssignmentExpressionOrHigher();
29113
29114
  return finishNode(factory.createAssertEntry(name, value), pos);
29114
29115
  }
29115
29116
  function parseAssertClause() {
@@ -37248,6 +37249,8 @@ var ts;
37248
37249
  return;
37249
37250
  }
37250
37251
  ts.setParent(node, parent);
37252
+ if (ts.tracing)
37253
+ node.tracingPath = file.path;
37251
37254
  var saveInStrictMode = inStrictMode;
37252
37255
  bindWorker(node);
37253
37256
  if (node.kind > 159) {
@@ -40923,8 +40926,13 @@ var ts;
40923
40926
  var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
40924
40927
  var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
40925
40928
  var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
40926
- var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
40929
+ var sourceFile = resolvedModule
40930
+ && (!resolutionDiagnostic || resolutionDiagnostic === ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set)
40931
+ && host.getSourceFile(resolvedModule.resolvedFileName);
40927
40932
  if (sourceFile) {
40933
+ if (resolutionDiagnostic) {
40934
+ error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
40935
+ }
40928
40936
  if (sourceFile.symbol) {
40929
40937
  if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
40930
40938
  errorOnImplicitAnyModule(false, errorNode, resolvedModule, moduleReference);
@@ -56685,10 +56693,21 @@ var ts;
56685
56693
  }
56686
56694
  if (flags & 2097152) {
56687
56695
  ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068));
56688
- return ts.reduceLeft(type.types, function (facts, t) { return facts & getTypeFacts(t, ignoreObjects); }, 16777215);
56696
+ return getIntersectionTypeFacts(type, ignoreObjects);
56689
56697
  }
56690
56698
  return 16777215;
56691
56699
  }
56700
+ function getIntersectionTypeFacts(type, ignoreObjects) {
56701
+ var oredFacts = 0;
56702
+ var andedFacts = 16777215;
56703
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
56704
+ var t = _a[_i];
56705
+ var f = getTypeFacts(t, ignoreObjects);
56706
+ oredFacts |= f;
56707
+ andedFacts &= f;
56708
+ }
56709
+ return oredFacts & 8288 | andedFacts & 16768927;
56710
+ }
56692
56711
  function getTypeWithFacts(type, include) {
56693
56712
  return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
56694
56713
  }
@@ -65278,7 +65297,7 @@ var ts;
65278
65297
  }
65279
65298
  }
65280
65299
  function checkExpression(node, checkMode, forceTuple) {
65281
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check", "checkExpression", { kind: node.kind, pos: node.pos, end: node.end });
65300
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check", "checkExpression", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
65282
65301
  var saveCurrentNode = currentNode;
65283
65302
  currentNode = node;
65284
65303
  instantiationCount = 0;
@@ -67607,7 +67626,7 @@ var ts;
67607
67626
  return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags);
67608
67627
  }
67609
67628
  function checkVariableDeclaration(node) {
67610
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check", "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end });
67629
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check", "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
67611
67630
  checkGrammarVariableDeclaration(node);
67612
67631
  checkVariableLikeDeclaration(node);
67613
67632
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
@@ -69596,6 +69615,17 @@ var ts;
69596
69615
  return false;
69597
69616
  }
69598
69617
  }
69618
+ if (!ts.isImportEqualsDeclaration(node) && node.assertClause) {
69619
+ var hasError = false;
69620
+ for (var _i = 0, _a = node.assertClause.elements; _i < _a.length; _i++) {
69621
+ var clause = _a[_i];
69622
+ if (!ts.isStringLiteral(clause.value)) {
69623
+ hasError = true;
69624
+ error(clause.value, ts.Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
69625
+ }
69626
+ }
69627
+ return !hasError;
69628
+ }
69599
69629
  return true;
69600
69630
  }
69601
69631
  function checkAliasSymbol(node) {
@@ -70231,7 +70261,7 @@ var ts;
70231
70261
  }
70232
70262
  }
70233
70263
  function checkDeferredNode(node) {
70234
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check", "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end });
70264
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check", "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
70235
70265
  var saveCurrentNode = currentNode;
70236
70266
  currentNode = node;
70237
70267
  instantiationCount = 0;
@@ -73811,7 +73841,7 @@ var ts;
73811
73841
  return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine);
73812
73842
  case 293:
73813
73843
  ts.Debug.type(node);
73814
- return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isStringLiteral));
73844
+ return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode));
73815
73845
  case 266:
73816
73846
  ts.Debug.type(node);
73817
73847
  return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings));
package/lib/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-dev.20220120";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20220124";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -8697,6 +8697,7 @@ var ts;
8697
8697
  Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path."),
8698
8698
  Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?"),
8699
8699
  Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
8700
+ Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
8700
8701
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
8701
8702
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
8702
8703
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -36106,7 +36107,7 @@ var ts;
36106
36107
  var pos = getNodePos();
36107
36108
  var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
36108
36109
  parseExpected(58 /* ColonToken */);
36109
- var value = parseLiteralLikeNode(10 /* StringLiteral */);
36110
+ var value = parseAssignmentExpressionOrHigher();
36110
36111
  return finishNode(factory.createAssertEntry(name, value), pos);
36111
36112
  }
36112
36113
  function parseAssertClause() {
@@ -45454,6 +45455,8 @@ var ts;
45454
45455
  return;
45455
45456
  }
45456
45457
  ts.setParent(node, parent);
45458
+ if (ts.tracing)
45459
+ node.tracingPath = file.path;
45457
45460
  var saveInStrictMode = inStrictMode;
45458
45461
  // Even though in the AST the jsdoc @typedef node belongs to the current node,
45459
45462
  // its symbol might be in the same scope with the current node's symbol. Consider:
@@ -46785,6 +46788,9 @@ var ts;
46785
46788
  TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
46786
46789
  TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
46787
46790
  TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
46791
+ // Masks
46792
+ TypeFacts[TypeFacts["OrFactsMask"] = 8288] = "OrFactsMask";
46793
+ TypeFacts[TypeFacts["AndFactsMask"] = 16768927] = "AndFactsMask";
46788
46794
  })(TypeFacts || (TypeFacts = {}));
46789
46795
  var typeofEQFacts = new ts.Map(ts.getEntries({
46790
46796
  string: 1 /* TypeofEQString */,
@@ -49845,8 +49851,14 @@ var ts;
49845
49851
  var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
49846
49852
  var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
49847
49853
  var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
49848
- var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
49854
+ var sourceFile = resolvedModule
49855
+ && (!resolutionDiagnostic || resolutionDiagnostic === ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set)
49856
+ && host.getSourceFile(resolvedModule.resolvedFileName);
49849
49857
  if (sourceFile) {
49858
+ // If there's a resolutionDiagnostic we need to report it even if a sourceFile is found.
49859
+ if (resolutionDiagnostic) {
49860
+ error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
49861
+ }
49850
49862
  if (sourceFile.symbol) {
49851
49863
  if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
49852
49864
  errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
@@ -67920,10 +67932,23 @@ var ts;
67920
67932
  // When an intersection contains a primitive type we ignore object type constituents as they are
67921
67933
  // presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
67922
67934
  ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
67923
- return ts.reduceLeft(type.types, function (facts, t) { return facts & getTypeFacts(t, ignoreObjects); }, 16777215 /* All */);
67935
+ return getIntersectionTypeFacts(type, ignoreObjects);
67924
67936
  }
67925
67937
  return 16777215 /* All */;
67926
67938
  }
67939
+ function getIntersectionTypeFacts(type, ignoreObjects) {
67940
+ // When computing the type facts of an intersection type, certain type facts are computed as `and`
67941
+ // and others are computed as `or`.
67942
+ var oredFacts = 0 /* None */;
67943
+ var andedFacts = 16777215 /* All */;
67944
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
67945
+ var t = _a[_i];
67946
+ var f = getTypeFacts(t, ignoreObjects);
67947
+ oredFacts |= f;
67948
+ andedFacts &= f;
67949
+ }
67950
+ return oredFacts & 8288 /* OrFactsMask */ | andedFacts & 16768927 /* AndFactsMask */;
67951
+ }
67927
67952
  function getTypeWithFacts(type, include) {
67928
67953
  return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
67929
67954
  }
@@ -77935,7 +77960,7 @@ var ts;
77935
77960
  }
77936
77961
  }
77937
77962
  function checkExpression(node, checkMode, forceTuple) {
77938
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end });
77963
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
77939
77964
  var saveCurrentNode = currentNode;
77940
77965
  currentNode = node;
77941
77966
  instantiationCount = 0;
@@ -80694,7 +80719,7 @@ var ts;
80694
80719
  return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags);
80695
80720
  }
80696
80721
  function checkVariableDeclaration(node) {
80697
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end });
80722
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
80698
80723
  checkGrammarVariableDeclaration(node);
80699
80724
  checkVariableLikeDeclaration(node);
80700
80725
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
@@ -83084,6 +83109,17 @@ var ts;
83084
83109
  return false;
83085
83110
  }
83086
83111
  }
83112
+ if (!ts.isImportEqualsDeclaration(node) && node.assertClause) {
83113
+ var hasError = false;
83114
+ for (var _i = 0, _a = node.assertClause.elements; _i < _a.length; _i++) {
83115
+ var clause = _a[_i];
83116
+ if (!ts.isStringLiteral(clause.value)) {
83117
+ hasError = true;
83118
+ error(clause.value, ts.Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
83119
+ }
83120
+ }
83121
+ return !hasError;
83122
+ }
83087
83123
  return true;
83088
83124
  }
83089
83125
  function checkAliasSymbol(node) {
@@ -83777,7 +83813,7 @@ var ts;
83777
83813
  }
83778
83814
  }
83779
83815
  function checkDeferredNode(node) {
83780
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end });
83816
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
83781
83817
  var saveCurrentNode = currentNode;
83782
83818
  currentNode = node;
83783
83819
  instantiationCount = 0;
@@ -87711,7 +87747,7 @@ var ts;
87711
87747
  return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine);
87712
87748
  case 293 /* AssertEntry */:
87713
87749
  ts.Debug.type(node);
87714
- return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isStringLiteral));
87750
+ return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode));
87715
87751
  case 266 /* ImportClause */:
87716
87752
  ts.Debug.type(node);
87717
87753
  return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings));
@@ -133739,7 +133775,7 @@ var ts;
133739
133775
  function getTextSpan(node, sourceFile, endNode) {
133740
133776
  var start = node.getStart(sourceFile);
133741
133777
  var end = (endNode || node).getEnd();
133742
- if (ts.isStringLiteralLike(node)) {
133778
+ if (ts.isStringLiteralLike(node) && (end - start) > 2) {
133743
133779
  ts.Debug.assert(endNode === undefined);
133744
133780
  start += 1;
133745
133781
  end -= 1;
@@ -136259,7 +136295,7 @@ var ts;
136259
136295
  return file && { reference: libReferenceDirective, fileName: file.fileName, file: file, unverified: false };
136260
136296
  }
136261
136297
  if ((_a = sourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.size()) {
136262
- var node = ts.getTokenAtPosition(sourceFile, position);
136298
+ var node = ts.getTouchingToken(sourceFile, position);
136263
136299
  if (ts.isModuleSpecifierLike(node) && ts.isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text, ts.getModeForUsageLocation(sourceFile, node))) {
136264
136300
  var verifiedFileName = (_b = sourceFile.resolvedModules.get(node.text, ts.getModeForUsageLocation(sourceFile, node))) === null || _b === void 0 ? void 0 : _b.resolvedFileName;
136265
136301
  var fileName = verifiedFileName || ts.resolvePath(ts.getDirectoryPath(sourceFile.fileName), node.text);
@@ -137059,7 +137095,7 @@ var ts;
137059
137095
  textSpan: ts.createTextSpanFromNode(declaration),
137060
137096
  // TODO(jfreeman): What should be the containerName when the container has a computed name?
137061
137097
  containerName: containerName ? containerName.text : "",
137062
- containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */, // TODO: GH#18217 Just use `container ? ...`
137098
+ containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */,
137063
137099
  };
137064
137100
  }
137065
137101
  })(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {}));
@@ -150185,7 +150221,7 @@ var ts;
150185
150221
  var errorCodes = [ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];
150186
150222
  codefix.registerCodeFix({
150187
150223
  errorCodes: errorCodes,
150188
- getCodeActions: function (context) {
150224
+ getCodeActions: function getCodeActionsToFixImplicitThis(context) {
150189
150225
  var sourceFile = context.sourceFile, program = context.program, span = context.span;
150190
150226
  var diagnostic;
150191
150227
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
@@ -150200,7 +150236,8 @@ var ts;
150200
150236
  });
150201
150237
  function doChange(changes, sourceFile, pos, checker) {
150202
150238
  var token = ts.getTokenAtPosition(sourceFile, pos);
150203
- ts.Debug.assert(token.kind === 108 /* ThisKeyword */);
150239
+ if (!ts.isThis(token))
150240
+ return undefined;
150204
150241
  var fn = ts.getThisContainer(token, /*includeArrowFunctions*/ false);
150205
150242
  if (!ts.isFunctionDeclaration(fn) && !ts.isFunctionExpression(fn))
150206
150243
  return undefined;
@@ -152010,6 +152047,9 @@ var ts;
152010
152047
  codefix.registerCodeFix({
152011
152048
  errorCodes: errorCodes,
152012
152049
  getCodeActions: function (context) {
152050
+ var syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
152051
+ if (syntacticDiagnostics.length)
152052
+ return;
152013
152053
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, context.span.start, context.span.length, context.errorCode); });
152014
152054
  return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Remove_unreachable_code, fixId, ts.Diagnostics.Remove_all_unreachable_code)];
152015
152055
  },
@@ -1652,7 +1652,7 @@ declare namespace ts {
1652
1652
  readonly kind: SyntaxKind.AssertEntry;
1653
1653
  readonly parent: AssertClause;
1654
1654
  readonly name: AssertionKey;
1655
- readonly value: StringLiteral;
1655
+ readonly value: Expression;
1656
1656
  }
1657
1657
  export interface AssertClause extends Node {
1658
1658
  readonly kind: SyntaxKind.AssertClause;
@@ -3576,8 +3576,8 @@ declare namespace ts {
3576
3576
  updateImportClause(node: ImportClause, isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
3577
3577
  createAssertClause(elements: NodeArray<AssertEntry>, multiLine?: boolean): AssertClause;
3578
3578
  updateAssertClause(node: AssertClause, elements: NodeArray<AssertEntry>, multiLine?: boolean): AssertClause;
3579
- createAssertEntry(name: AssertionKey, value: StringLiteral): AssertEntry;
3580
- updateAssertEntry(node: AssertEntry, name: AssertionKey, value: StringLiteral): AssertEntry;
3579
+ createAssertEntry(name: AssertionKey, value: Expression): AssertEntry;
3580
+ updateAssertEntry(node: AssertEntry, name: AssertionKey, value: Expression): AssertEntry;
3581
3581
  createNamespaceImport(name: Identifier): NamespaceImport;
3582
3582
  updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport;
3583
3583
  createNamespaceExport(name: Identifier): NamespaceExport;
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220120";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220124";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -8891,6 +8891,7 @@ var ts;
8891
8891
  Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path."),
8892
8892
  Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?"),
8893
8893
  Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
8894
+ Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
8894
8895
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
8895
8896
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
8896
8897
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -36300,7 +36301,7 @@ var ts;
36300
36301
  var pos = getNodePos();
36301
36302
  var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
36302
36303
  parseExpected(58 /* ColonToken */);
36303
- var value = parseLiteralLikeNode(10 /* StringLiteral */);
36304
+ var value = parseAssignmentExpressionOrHigher();
36304
36305
  return finishNode(factory.createAssertEntry(name, value), pos);
36305
36306
  }
36306
36307
  function parseAssertClause() {
@@ -45648,6 +45649,8 @@ var ts;
45648
45649
  return;
45649
45650
  }
45650
45651
  ts.setParent(node, parent);
45652
+ if (ts.tracing)
45653
+ node.tracingPath = file.path;
45651
45654
  var saveInStrictMode = inStrictMode;
45652
45655
  // Even though in the AST the jsdoc @typedef node belongs to the current node,
45653
45656
  // its symbol might be in the same scope with the current node's symbol. Consider:
@@ -46979,6 +46982,9 @@ var ts;
46979
46982
  TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
46980
46983
  TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
46981
46984
  TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
46985
+ // Masks
46986
+ TypeFacts[TypeFacts["OrFactsMask"] = 8288] = "OrFactsMask";
46987
+ TypeFacts[TypeFacts["AndFactsMask"] = 16768927] = "AndFactsMask";
46982
46988
  })(TypeFacts || (TypeFacts = {}));
46983
46989
  var typeofEQFacts = new ts.Map(ts.getEntries({
46984
46990
  string: 1 /* TypeofEQString */,
@@ -50039,8 +50045,14 @@ var ts;
50039
50045
  var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
50040
50046
  var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
50041
50047
  var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
50042
- var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
50048
+ var sourceFile = resolvedModule
50049
+ && (!resolutionDiagnostic || resolutionDiagnostic === ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set)
50050
+ && host.getSourceFile(resolvedModule.resolvedFileName);
50043
50051
  if (sourceFile) {
50052
+ // If there's a resolutionDiagnostic we need to report it even if a sourceFile is found.
50053
+ if (resolutionDiagnostic) {
50054
+ error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
50055
+ }
50044
50056
  if (sourceFile.symbol) {
50045
50057
  if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
50046
50058
  errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
@@ -68114,10 +68126,23 @@ var ts;
68114
68126
  // When an intersection contains a primitive type we ignore object type constituents as they are
68115
68127
  // presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
68116
68128
  ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
68117
- return ts.reduceLeft(type.types, function (facts, t) { return facts & getTypeFacts(t, ignoreObjects); }, 16777215 /* All */);
68129
+ return getIntersectionTypeFacts(type, ignoreObjects);
68118
68130
  }
68119
68131
  return 16777215 /* All */;
68120
68132
  }
68133
+ function getIntersectionTypeFacts(type, ignoreObjects) {
68134
+ // When computing the type facts of an intersection type, certain type facts are computed as `and`
68135
+ // and others are computed as `or`.
68136
+ var oredFacts = 0 /* None */;
68137
+ var andedFacts = 16777215 /* All */;
68138
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
68139
+ var t = _a[_i];
68140
+ var f = getTypeFacts(t, ignoreObjects);
68141
+ oredFacts |= f;
68142
+ andedFacts &= f;
68143
+ }
68144
+ return oredFacts & 8288 /* OrFactsMask */ | andedFacts & 16768927 /* AndFactsMask */;
68145
+ }
68121
68146
  function getTypeWithFacts(type, include) {
68122
68147
  return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
68123
68148
  }
@@ -78129,7 +78154,7 @@ var ts;
78129
78154
  }
78130
78155
  }
78131
78156
  function checkExpression(node, checkMode, forceTuple) {
78132
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end });
78157
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
78133
78158
  var saveCurrentNode = currentNode;
78134
78159
  currentNode = node;
78135
78160
  instantiationCount = 0;
@@ -80888,7 +80913,7 @@ var ts;
80888
80913
  return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags);
80889
80914
  }
80890
80915
  function checkVariableDeclaration(node) {
80891
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end });
80916
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
80892
80917
  checkGrammarVariableDeclaration(node);
80893
80918
  checkVariableLikeDeclaration(node);
80894
80919
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
@@ -83278,6 +83303,17 @@ var ts;
83278
83303
  return false;
83279
83304
  }
83280
83305
  }
83306
+ if (!ts.isImportEqualsDeclaration(node) && node.assertClause) {
83307
+ var hasError = false;
83308
+ for (var _i = 0, _a = node.assertClause.elements; _i < _a.length; _i++) {
83309
+ var clause = _a[_i];
83310
+ if (!ts.isStringLiteral(clause.value)) {
83311
+ hasError = true;
83312
+ error(clause.value, ts.Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
83313
+ }
83314
+ }
83315
+ return !hasError;
83316
+ }
83281
83317
  return true;
83282
83318
  }
83283
83319
  function checkAliasSymbol(node) {
@@ -83971,7 +84007,7 @@ var ts;
83971
84007
  }
83972
84008
  }
83973
84009
  function checkDeferredNode(node) {
83974
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end });
84010
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
83975
84011
  var saveCurrentNode = currentNode;
83976
84012
  currentNode = node;
83977
84013
  instantiationCount = 0;
@@ -87905,7 +87941,7 @@ var ts;
87905
87941
  return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine);
87906
87942
  case 293 /* AssertEntry */:
87907
87943
  ts.Debug.type(node);
87908
- return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isStringLiteral));
87944
+ return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode));
87909
87945
  case 266 /* ImportClause */:
87910
87946
  ts.Debug.type(node);
87911
87947
  return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings));
@@ -134350,7 +134386,7 @@ var ts;
134350
134386
  function getTextSpan(node, sourceFile, endNode) {
134351
134387
  var start = node.getStart(sourceFile);
134352
134388
  var end = (endNode || node).getEnd();
134353
- if (ts.isStringLiteralLike(node)) {
134389
+ if (ts.isStringLiteralLike(node) && (end - start) > 2) {
134354
134390
  ts.Debug.assert(endNode === undefined);
134355
134391
  start += 1;
134356
134392
  end -= 1;
@@ -136870,7 +136906,7 @@ var ts;
136870
136906
  return file && { reference: libReferenceDirective, fileName: file.fileName, file: file, unverified: false };
136871
136907
  }
136872
136908
  if ((_a = sourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.size()) {
136873
- var node = ts.getTokenAtPosition(sourceFile, position);
136909
+ var node = ts.getTouchingToken(sourceFile, position);
136874
136910
  if (ts.isModuleSpecifierLike(node) && ts.isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text, ts.getModeForUsageLocation(sourceFile, node))) {
136875
136911
  var verifiedFileName = (_b = sourceFile.resolvedModules.get(node.text, ts.getModeForUsageLocation(sourceFile, node))) === null || _b === void 0 ? void 0 : _b.resolvedFileName;
136876
136912
  var fileName = verifiedFileName || ts.resolvePath(ts.getDirectoryPath(sourceFile.fileName), node.text);
@@ -137670,7 +137706,7 @@ var ts;
137670
137706
  textSpan: ts.createTextSpanFromNode(declaration),
137671
137707
  // TODO(jfreeman): What should be the containerName when the container has a computed name?
137672
137708
  containerName: containerName ? containerName.text : "",
137673
- containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */, // TODO: GH#18217 Just use `container ? ...`
137709
+ containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */,
137674
137710
  };
137675
137711
  }
137676
137712
  })(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {}));
@@ -150796,7 +150832,7 @@ var ts;
150796
150832
  var errorCodes = [ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];
150797
150833
  codefix.registerCodeFix({
150798
150834
  errorCodes: errorCodes,
150799
- getCodeActions: function (context) {
150835
+ getCodeActions: function getCodeActionsToFixImplicitThis(context) {
150800
150836
  var sourceFile = context.sourceFile, program = context.program, span = context.span;
150801
150837
  var diagnostic;
150802
150838
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
@@ -150811,7 +150847,8 @@ var ts;
150811
150847
  });
150812
150848
  function doChange(changes, sourceFile, pos, checker) {
150813
150849
  var token = ts.getTokenAtPosition(sourceFile, pos);
150814
- ts.Debug.assert(token.kind === 108 /* ThisKeyword */);
150850
+ if (!ts.isThis(token))
150851
+ return undefined;
150815
150852
  var fn = ts.getThisContainer(token, /*includeArrowFunctions*/ false);
150816
150853
  if (!ts.isFunctionDeclaration(fn) && !ts.isFunctionExpression(fn))
150817
150854
  return undefined;
@@ -152621,6 +152658,9 @@ var ts;
152621
152658
  codefix.registerCodeFix({
152622
152659
  errorCodes: errorCodes,
152623
152660
  getCodeActions: function (context) {
152661
+ var syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
152662
+ if (syntacticDiagnostics.length)
152663
+ return;
152624
152664
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, context.span.start, context.span.length, context.errorCode); });
152625
152665
  return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Remove_unreachable_code, fixId, ts.Diagnostics.Remove_all_unreachable_code)];
152626
152666
  },
@@ -1652,7 +1652,7 @@ declare namespace ts {
1652
1652
  readonly kind: SyntaxKind.AssertEntry;
1653
1653
  readonly parent: AssertClause;
1654
1654
  readonly name: AssertionKey;
1655
- readonly value: StringLiteral;
1655
+ readonly value: Expression;
1656
1656
  }
1657
1657
  export interface AssertClause extends Node {
1658
1658
  readonly kind: SyntaxKind.AssertClause;
@@ -3576,8 +3576,8 @@ declare namespace ts {
3576
3576
  updateImportClause(node: ImportClause, isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
3577
3577
  createAssertClause(elements: NodeArray<AssertEntry>, multiLine?: boolean): AssertClause;
3578
3578
  updateAssertClause(node: AssertClause, elements: NodeArray<AssertEntry>, multiLine?: boolean): AssertClause;
3579
- createAssertEntry(name: AssertionKey, value: StringLiteral): AssertEntry;
3580
- updateAssertEntry(node: AssertEntry, name: AssertionKey, value: StringLiteral): AssertEntry;
3579
+ createAssertEntry(name: AssertionKey, value: Expression): AssertEntry;
3580
+ updateAssertEntry(node: AssertEntry, name: AssertionKey, value: Expression): AssertEntry;
3581
3581
  createNamespaceImport(name: Identifier): NamespaceImport;
3582
3582
  updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport;
3583
3583
  createNamespaceExport(name: Identifier): NamespaceExport;
package/lib/typescript.js CHANGED
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220120";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220124";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -8891,6 +8891,7 @@ var ts;
8891
8891
  Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path."),
8892
8892
  Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?"),
8893
8893
  Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
8894
+ Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
8894
8895
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
8895
8896
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
8896
8897
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -36300,7 +36301,7 @@ var ts;
36300
36301
  var pos = getNodePos();
36301
36302
  var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
36302
36303
  parseExpected(58 /* ColonToken */);
36303
- var value = parseLiteralLikeNode(10 /* StringLiteral */);
36304
+ var value = parseAssignmentExpressionOrHigher();
36304
36305
  return finishNode(factory.createAssertEntry(name, value), pos);
36305
36306
  }
36306
36307
  function parseAssertClause() {
@@ -45648,6 +45649,8 @@ var ts;
45648
45649
  return;
45649
45650
  }
45650
45651
  ts.setParent(node, parent);
45652
+ if (ts.tracing)
45653
+ node.tracingPath = file.path;
45651
45654
  var saveInStrictMode = inStrictMode;
45652
45655
  // Even though in the AST the jsdoc @typedef node belongs to the current node,
45653
45656
  // its symbol might be in the same scope with the current node's symbol. Consider:
@@ -46979,6 +46982,9 @@ var ts;
46979
46982
  TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
46980
46983
  TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
46981
46984
  TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
46985
+ // Masks
46986
+ TypeFacts[TypeFacts["OrFactsMask"] = 8288] = "OrFactsMask";
46987
+ TypeFacts[TypeFacts["AndFactsMask"] = 16768927] = "AndFactsMask";
46982
46988
  })(TypeFacts || (TypeFacts = {}));
46983
46989
  var typeofEQFacts = new ts.Map(ts.getEntries({
46984
46990
  string: 1 /* TypeofEQString */,
@@ -50039,8 +50045,14 @@ var ts;
50039
50045
  var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
50040
50046
  var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
50041
50047
  var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
50042
- var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
50048
+ var sourceFile = resolvedModule
50049
+ && (!resolutionDiagnostic || resolutionDiagnostic === ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set)
50050
+ && host.getSourceFile(resolvedModule.resolvedFileName);
50043
50051
  if (sourceFile) {
50052
+ // If there's a resolutionDiagnostic we need to report it even if a sourceFile is found.
50053
+ if (resolutionDiagnostic) {
50054
+ error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
50055
+ }
50044
50056
  if (sourceFile.symbol) {
50045
50057
  if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
50046
50058
  errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
@@ -68114,10 +68126,23 @@ var ts;
68114
68126
  // When an intersection contains a primitive type we ignore object type constituents as they are
68115
68127
  // presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
68116
68128
  ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
68117
- return ts.reduceLeft(type.types, function (facts, t) { return facts & getTypeFacts(t, ignoreObjects); }, 16777215 /* All */);
68129
+ return getIntersectionTypeFacts(type, ignoreObjects);
68118
68130
  }
68119
68131
  return 16777215 /* All */;
68120
68132
  }
68133
+ function getIntersectionTypeFacts(type, ignoreObjects) {
68134
+ // When computing the type facts of an intersection type, certain type facts are computed as `and`
68135
+ // and others are computed as `or`.
68136
+ var oredFacts = 0 /* None */;
68137
+ var andedFacts = 16777215 /* All */;
68138
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
68139
+ var t = _a[_i];
68140
+ var f = getTypeFacts(t, ignoreObjects);
68141
+ oredFacts |= f;
68142
+ andedFacts &= f;
68143
+ }
68144
+ return oredFacts & 8288 /* OrFactsMask */ | andedFacts & 16768927 /* AndFactsMask */;
68145
+ }
68121
68146
  function getTypeWithFacts(type, include) {
68122
68147
  return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
68123
68148
  }
@@ -78129,7 +78154,7 @@ var ts;
78129
78154
  }
78130
78155
  }
78131
78156
  function checkExpression(node, checkMode, forceTuple) {
78132
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end });
78157
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
78133
78158
  var saveCurrentNode = currentNode;
78134
78159
  currentNode = node;
78135
78160
  instantiationCount = 0;
@@ -80888,7 +80913,7 @@ var ts;
80888
80913
  return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags);
80889
80914
  }
80890
80915
  function checkVariableDeclaration(node) {
80891
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end });
80916
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
80892
80917
  checkGrammarVariableDeclaration(node);
80893
80918
  checkVariableLikeDeclaration(node);
80894
80919
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
@@ -83278,6 +83303,17 @@ var ts;
83278
83303
  return false;
83279
83304
  }
83280
83305
  }
83306
+ if (!ts.isImportEqualsDeclaration(node) && node.assertClause) {
83307
+ var hasError = false;
83308
+ for (var _i = 0, _a = node.assertClause.elements; _i < _a.length; _i++) {
83309
+ var clause = _a[_i];
83310
+ if (!ts.isStringLiteral(clause.value)) {
83311
+ hasError = true;
83312
+ error(clause.value, ts.Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
83313
+ }
83314
+ }
83315
+ return !hasError;
83316
+ }
83281
83317
  return true;
83282
83318
  }
83283
83319
  function checkAliasSymbol(node) {
@@ -83971,7 +84007,7 @@ var ts;
83971
84007
  }
83972
84008
  }
83973
84009
  function checkDeferredNode(node) {
83974
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end });
84010
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
83975
84011
  var saveCurrentNode = currentNode;
83976
84012
  currentNode = node;
83977
84013
  instantiationCount = 0;
@@ -87905,7 +87941,7 @@ var ts;
87905
87941
  return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine);
87906
87942
  case 293 /* AssertEntry */:
87907
87943
  ts.Debug.type(node);
87908
- return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isStringLiteral));
87944
+ return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode));
87909
87945
  case 266 /* ImportClause */:
87910
87946
  ts.Debug.type(node);
87911
87947
  return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings));
@@ -134350,7 +134386,7 @@ var ts;
134350
134386
  function getTextSpan(node, sourceFile, endNode) {
134351
134387
  var start = node.getStart(sourceFile);
134352
134388
  var end = (endNode || node).getEnd();
134353
- if (ts.isStringLiteralLike(node)) {
134389
+ if (ts.isStringLiteralLike(node) && (end - start) > 2) {
134354
134390
  ts.Debug.assert(endNode === undefined);
134355
134391
  start += 1;
134356
134392
  end -= 1;
@@ -136870,7 +136906,7 @@ var ts;
136870
136906
  return file && { reference: libReferenceDirective, fileName: file.fileName, file: file, unverified: false };
136871
136907
  }
136872
136908
  if ((_a = sourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.size()) {
136873
- var node = ts.getTokenAtPosition(sourceFile, position);
136909
+ var node = ts.getTouchingToken(sourceFile, position);
136874
136910
  if (ts.isModuleSpecifierLike(node) && ts.isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text, ts.getModeForUsageLocation(sourceFile, node))) {
136875
136911
  var verifiedFileName = (_b = sourceFile.resolvedModules.get(node.text, ts.getModeForUsageLocation(sourceFile, node))) === null || _b === void 0 ? void 0 : _b.resolvedFileName;
136876
136912
  var fileName = verifiedFileName || ts.resolvePath(ts.getDirectoryPath(sourceFile.fileName), node.text);
@@ -137670,7 +137706,7 @@ var ts;
137670
137706
  textSpan: ts.createTextSpanFromNode(declaration),
137671
137707
  // TODO(jfreeman): What should be the containerName when the container has a computed name?
137672
137708
  containerName: containerName ? containerName.text : "",
137673
- containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */, // TODO: GH#18217 Just use `container ? ...`
137709
+ containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */,
137674
137710
  };
137675
137711
  }
137676
137712
  })(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {}));
@@ -150796,7 +150832,7 @@ var ts;
150796
150832
  var errorCodes = [ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];
150797
150833
  codefix.registerCodeFix({
150798
150834
  errorCodes: errorCodes,
150799
- getCodeActions: function (context) {
150835
+ getCodeActions: function getCodeActionsToFixImplicitThis(context) {
150800
150836
  var sourceFile = context.sourceFile, program = context.program, span = context.span;
150801
150837
  var diagnostic;
150802
150838
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
@@ -150811,7 +150847,8 @@ var ts;
150811
150847
  });
150812
150848
  function doChange(changes, sourceFile, pos, checker) {
150813
150849
  var token = ts.getTokenAtPosition(sourceFile, pos);
150814
- ts.Debug.assert(token.kind === 108 /* ThisKeyword */);
150850
+ if (!ts.isThis(token))
150851
+ return undefined;
150815
150852
  var fn = ts.getThisContainer(token, /*includeArrowFunctions*/ false);
150816
150853
  if (!ts.isFunctionDeclaration(fn) && !ts.isFunctionExpression(fn))
150817
150854
  return undefined;
@@ -152621,6 +152658,9 @@ var ts;
152621
152658
  codefix.registerCodeFix({
152622
152659
  errorCodes: errorCodes,
152623
152660
  getCodeActions: function (context) {
152661
+ var syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
152662
+ if (syntacticDiagnostics.length)
152663
+ return;
152624
152664
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, context.span.start, context.span.length, context.errorCode); });
152625
152665
  return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Remove_unreachable_code, fixId, ts.Diagnostics.Remove_all_unreachable_code)];
152626
152666
  },
@@ -1652,7 +1652,7 @@ declare namespace ts {
1652
1652
  readonly kind: SyntaxKind.AssertEntry;
1653
1653
  readonly parent: AssertClause;
1654
1654
  readonly name: AssertionKey;
1655
- readonly value: StringLiteral;
1655
+ readonly value: Expression;
1656
1656
  }
1657
1657
  export interface AssertClause extends Node {
1658
1658
  readonly kind: SyntaxKind.AssertClause;
@@ -3576,8 +3576,8 @@ declare namespace ts {
3576
3576
  updateImportClause(node: ImportClause, isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
3577
3577
  createAssertClause(elements: NodeArray<AssertEntry>, multiLine?: boolean): AssertClause;
3578
3578
  updateAssertClause(node: AssertClause, elements: NodeArray<AssertEntry>, multiLine?: boolean): AssertClause;
3579
- createAssertEntry(name: AssertionKey, value: StringLiteral): AssertEntry;
3580
- updateAssertEntry(node: AssertEntry, name: AssertionKey, value: StringLiteral): AssertEntry;
3579
+ createAssertEntry(name: AssertionKey, value: Expression): AssertEntry;
3580
+ updateAssertEntry(node: AssertEntry, name: AssertionKey, value: Expression): AssertEntry;
3581
3581
  createNamespaceImport(name: Identifier): NamespaceImport;
3582
3582
  updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport;
3583
3583
  createNamespaceExport(name: Identifier): NamespaceExport;
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220120";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220124";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -8891,6 +8891,7 @@ var ts;
8891
8891
  Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path."),
8892
8892
  Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?"),
8893
8893
  Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
8894
+ Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
8894
8895
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
8895
8896
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
8896
8897
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -36300,7 +36301,7 @@ var ts;
36300
36301
  var pos = getNodePos();
36301
36302
  var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
36302
36303
  parseExpected(58 /* ColonToken */);
36303
- var value = parseLiteralLikeNode(10 /* StringLiteral */);
36304
+ var value = parseAssignmentExpressionOrHigher();
36304
36305
  return finishNode(factory.createAssertEntry(name, value), pos);
36305
36306
  }
36306
36307
  function parseAssertClause() {
@@ -45648,6 +45649,8 @@ var ts;
45648
45649
  return;
45649
45650
  }
45650
45651
  ts.setParent(node, parent);
45652
+ if (ts.tracing)
45653
+ node.tracingPath = file.path;
45651
45654
  var saveInStrictMode = inStrictMode;
45652
45655
  // Even though in the AST the jsdoc @typedef node belongs to the current node,
45653
45656
  // its symbol might be in the same scope with the current node's symbol. Consider:
@@ -46979,6 +46982,9 @@ var ts;
46979
46982
  TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
46980
46983
  TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
46981
46984
  TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
46985
+ // Masks
46986
+ TypeFacts[TypeFacts["OrFactsMask"] = 8288] = "OrFactsMask";
46987
+ TypeFacts[TypeFacts["AndFactsMask"] = 16768927] = "AndFactsMask";
46982
46988
  })(TypeFacts || (TypeFacts = {}));
46983
46989
  var typeofEQFacts = new ts.Map(ts.getEntries({
46984
46990
  string: 1 /* TypeofEQString */,
@@ -50039,8 +50045,14 @@ var ts;
50039
50045
  var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
50040
50046
  var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
50041
50047
  var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
50042
- var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
50048
+ var sourceFile = resolvedModule
50049
+ && (!resolutionDiagnostic || resolutionDiagnostic === ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set)
50050
+ && host.getSourceFile(resolvedModule.resolvedFileName);
50043
50051
  if (sourceFile) {
50052
+ // If there's a resolutionDiagnostic we need to report it even if a sourceFile is found.
50053
+ if (resolutionDiagnostic) {
50054
+ error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
50055
+ }
50044
50056
  if (sourceFile.symbol) {
50045
50057
  if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
50046
50058
  errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
@@ -68114,10 +68126,23 @@ var ts;
68114
68126
  // When an intersection contains a primitive type we ignore object type constituents as they are
68115
68127
  // presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
68116
68128
  ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
68117
- return ts.reduceLeft(type.types, function (facts, t) { return facts & getTypeFacts(t, ignoreObjects); }, 16777215 /* All */);
68129
+ return getIntersectionTypeFacts(type, ignoreObjects);
68118
68130
  }
68119
68131
  return 16777215 /* All */;
68120
68132
  }
68133
+ function getIntersectionTypeFacts(type, ignoreObjects) {
68134
+ // When computing the type facts of an intersection type, certain type facts are computed as `and`
68135
+ // and others are computed as `or`.
68136
+ var oredFacts = 0 /* None */;
68137
+ var andedFacts = 16777215 /* All */;
68138
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
68139
+ var t = _a[_i];
68140
+ var f = getTypeFacts(t, ignoreObjects);
68141
+ oredFacts |= f;
68142
+ andedFacts &= f;
68143
+ }
68144
+ return oredFacts & 8288 /* OrFactsMask */ | andedFacts & 16768927 /* AndFactsMask */;
68145
+ }
68121
68146
  function getTypeWithFacts(type, include) {
68122
68147
  return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
68123
68148
  }
@@ -78129,7 +78154,7 @@ var ts;
78129
78154
  }
78130
78155
  }
78131
78156
  function checkExpression(node, checkMode, forceTuple) {
78132
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end });
78157
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
78133
78158
  var saveCurrentNode = currentNode;
78134
78159
  currentNode = node;
78135
78160
  instantiationCount = 0;
@@ -80888,7 +80913,7 @@ var ts;
80888
80913
  return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags);
80889
80914
  }
80890
80915
  function checkVariableDeclaration(node) {
80891
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end });
80916
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
80892
80917
  checkGrammarVariableDeclaration(node);
80893
80918
  checkVariableLikeDeclaration(node);
80894
80919
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
@@ -83278,6 +83303,17 @@ var ts;
83278
83303
  return false;
83279
83304
  }
83280
83305
  }
83306
+ if (!ts.isImportEqualsDeclaration(node) && node.assertClause) {
83307
+ var hasError = false;
83308
+ for (var _i = 0, _a = node.assertClause.elements; _i < _a.length; _i++) {
83309
+ var clause = _a[_i];
83310
+ if (!ts.isStringLiteral(clause.value)) {
83311
+ hasError = true;
83312
+ error(clause.value, ts.Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
83313
+ }
83314
+ }
83315
+ return !hasError;
83316
+ }
83281
83317
  return true;
83282
83318
  }
83283
83319
  function checkAliasSymbol(node) {
@@ -83971,7 +84007,7 @@ var ts;
83971
84007
  }
83972
84008
  }
83973
84009
  function checkDeferredNode(node) {
83974
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end });
84010
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
83975
84011
  var saveCurrentNode = currentNode;
83976
84012
  currentNode = node;
83977
84013
  instantiationCount = 0;
@@ -87905,7 +87941,7 @@ var ts;
87905
87941
  return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine);
87906
87942
  case 293 /* AssertEntry */:
87907
87943
  ts.Debug.type(node);
87908
- return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isStringLiteral));
87944
+ return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode));
87909
87945
  case 266 /* ImportClause */:
87910
87946
  ts.Debug.type(node);
87911
87947
  return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings));
@@ -134350,7 +134386,7 @@ var ts;
134350
134386
  function getTextSpan(node, sourceFile, endNode) {
134351
134387
  var start = node.getStart(sourceFile);
134352
134388
  var end = (endNode || node).getEnd();
134353
- if (ts.isStringLiteralLike(node)) {
134389
+ if (ts.isStringLiteralLike(node) && (end - start) > 2) {
134354
134390
  ts.Debug.assert(endNode === undefined);
134355
134391
  start += 1;
134356
134392
  end -= 1;
@@ -136870,7 +136906,7 @@ var ts;
136870
136906
  return file && { reference: libReferenceDirective, fileName: file.fileName, file: file, unverified: false };
136871
136907
  }
136872
136908
  if ((_a = sourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.size()) {
136873
- var node = ts.getTokenAtPosition(sourceFile, position);
136909
+ var node = ts.getTouchingToken(sourceFile, position);
136874
136910
  if (ts.isModuleSpecifierLike(node) && ts.isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text, ts.getModeForUsageLocation(sourceFile, node))) {
136875
136911
  var verifiedFileName = (_b = sourceFile.resolvedModules.get(node.text, ts.getModeForUsageLocation(sourceFile, node))) === null || _b === void 0 ? void 0 : _b.resolvedFileName;
136876
136912
  var fileName = verifiedFileName || ts.resolvePath(ts.getDirectoryPath(sourceFile.fileName), node.text);
@@ -137670,7 +137706,7 @@ var ts;
137670
137706
  textSpan: ts.createTextSpanFromNode(declaration),
137671
137707
  // TODO(jfreeman): What should be the containerName when the container has a computed name?
137672
137708
  containerName: containerName ? containerName.text : "",
137673
- containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */, // TODO: GH#18217 Just use `container ? ...`
137709
+ containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */,
137674
137710
  };
137675
137711
  }
137676
137712
  })(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {}));
@@ -150796,7 +150832,7 @@ var ts;
150796
150832
  var errorCodes = [ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];
150797
150833
  codefix.registerCodeFix({
150798
150834
  errorCodes: errorCodes,
150799
- getCodeActions: function (context) {
150835
+ getCodeActions: function getCodeActionsToFixImplicitThis(context) {
150800
150836
  var sourceFile = context.sourceFile, program = context.program, span = context.span;
150801
150837
  var diagnostic;
150802
150838
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
@@ -150811,7 +150847,8 @@ var ts;
150811
150847
  });
150812
150848
  function doChange(changes, sourceFile, pos, checker) {
150813
150849
  var token = ts.getTokenAtPosition(sourceFile, pos);
150814
- ts.Debug.assert(token.kind === 108 /* ThisKeyword */);
150850
+ if (!ts.isThis(token))
150851
+ return undefined;
150815
150852
  var fn = ts.getThisContainer(token, /*includeArrowFunctions*/ false);
150816
150853
  if (!ts.isFunctionDeclaration(fn) && !ts.isFunctionExpression(fn))
150817
150854
  return undefined;
@@ -152621,6 +152658,9 @@ var ts;
152621
152658
  codefix.registerCodeFix({
152622
152659
  errorCodes: errorCodes,
152623
152660
  getCodeActions: function (context) {
152661
+ var syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
152662
+ if (syntacticDiagnostics.length)
152663
+ return;
152624
152664
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, context.span.start, context.span.length, context.errorCode); });
152625
152665
  return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Remove_unreachable_code, fixId, ts.Diagnostics.Remove_all_unreachable_code)];
152626
152666
  },
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-dev.20220120";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220124";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -8686,6 +8686,7 @@ var ts;
8686
8686
  Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path."),
8687
8687
  Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?"),
8688
8688
  Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
8689
+ Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
8689
8690
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
8690
8691
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
8691
8692
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -36095,7 +36096,7 @@ var ts;
36095
36096
  var pos = getNodePos();
36096
36097
  var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
36097
36098
  parseExpected(58 /* ColonToken */);
36098
- var value = parseLiteralLikeNode(10 /* StringLiteral */);
36099
+ var value = parseAssignmentExpressionOrHigher();
36099
36100
  return finishNode(factory.createAssertEntry(name, value), pos);
36100
36101
  }
36101
36102
  function parseAssertClause() {
@@ -45443,6 +45444,8 @@ var ts;
45443
45444
  return;
45444
45445
  }
45445
45446
  ts.setParent(node, parent);
45447
+ if (ts.tracing)
45448
+ node.tracingPath = file.path;
45446
45449
  var saveInStrictMode = inStrictMode;
45447
45450
  // Even though in the AST the jsdoc @typedef node belongs to the current node,
45448
45451
  // its symbol might be in the same scope with the current node's symbol. Consider:
@@ -46774,6 +46777,9 @@ var ts;
46774
46777
  TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
46775
46778
  TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
46776
46779
  TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
46780
+ // Masks
46781
+ TypeFacts[TypeFacts["OrFactsMask"] = 8288] = "OrFactsMask";
46782
+ TypeFacts[TypeFacts["AndFactsMask"] = 16768927] = "AndFactsMask";
46777
46783
  })(TypeFacts || (TypeFacts = {}));
46778
46784
  var typeofEQFacts = new ts.Map(ts.getEntries({
46779
46785
  string: 1 /* TypeofEQString */,
@@ -49834,8 +49840,14 @@ var ts;
49834
49840
  var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
49835
49841
  var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
49836
49842
  var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
49837
- var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
49843
+ var sourceFile = resolvedModule
49844
+ && (!resolutionDiagnostic || resolutionDiagnostic === ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set)
49845
+ && host.getSourceFile(resolvedModule.resolvedFileName);
49838
49846
  if (sourceFile) {
49847
+ // If there's a resolutionDiagnostic we need to report it even if a sourceFile is found.
49848
+ if (resolutionDiagnostic) {
49849
+ error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
49850
+ }
49839
49851
  if (sourceFile.symbol) {
49840
49852
  if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
49841
49853
  errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
@@ -67909,10 +67921,23 @@ var ts;
67909
67921
  // When an intersection contains a primitive type we ignore object type constituents as they are
67910
67922
  // presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
67911
67923
  ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
67912
- return ts.reduceLeft(type.types, function (facts, t) { return facts & getTypeFacts(t, ignoreObjects); }, 16777215 /* All */);
67924
+ return getIntersectionTypeFacts(type, ignoreObjects);
67913
67925
  }
67914
67926
  return 16777215 /* All */;
67915
67927
  }
67928
+ function getIntersectionTypeFacts(type, ignoreObjects) {
67929
+ // When computing the type facts of an intersection type, certain type facts are computed as `and`
67930
+ // and others are computed as `or`.
67931
+ var oredFacts = 0 /* None */;
67932
+ var andedFacts = 16777215 /* All */;
67933
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
67934
+ var t = _a[_i];
67935
+ var f = getTypeFacts(t, ignoreObjects);
67936
+ oredFacts |= f;
67937
+ andedFacts &= f;
67938
+ }
67939
+ return oredFacts & 8288 /* OrFactsMask */ | andedFacts & 16768927 /* AndFactsMask */;
67940
+ }
67916
67941
  function getTypeWithFacts(type, include) {
67917
67942
  return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
67918
67943
  }
@@ -77924,7 +77949,7 @@ var ts;
77924
77949
  }
77925
77950
  }
77926
77951
  function checkExpression(node, checkMode, forceTuple) {
77927
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end });
77952
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
77928
77953
  var saveCurrentNode = currentNode;
77929
77954
  currentNode = node;
77930
77955
  instantiationCount = 0;
@@ -80683,7 +80708,7 @@ var ts;
80683
80708
  return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags);
80684
80709
  }
80685
80710
  function checkVariableDeclaration(node) {
80686
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end });
80711
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
80687
80712
  checkGrammarVariableDeclaration(node);
80688
80713
  checkVariableLikeDeclaration(node);
80689
80714
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
@@ -83073,6 +83098,17 @@ var ts;
83073
83098
  return false;
83074
83099
  }
83075
83100
  }
83101
+ if (!ts.isImportEqualsDeclaration(node) && node.assertClause) {
83102
+ var hasError = false;
83103
+ for (var _i = 0, _a = node.assertClause.elements; _i < _a.length; _i++) {
83104
+ var clause = _a[_i];
83105
+ if (!ts.isStringLiteral(clause.value)) {
83106
+ hasError = true;
83107
+ error(clause.value, ts.Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
83108
+ }
83109
+ }
83110
+ return !hasError;
83111
+ }
83076
83112
  return true;
83077
83113
  }
83078
83114
  function checkAliasSymbol(node) {
@@ -83766,7 +83802,7 @@ var ts;
83766
83802
  }
83767
83803
  }
83768
83804
  function checkDeferredNode(node) {
83769
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end });
83805
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
83770
83806
  var saveCurrentNode = currentNode;
83771
83807
  currentNode = node;
83772
83808
  instantiationCount = 0;
@@ -87700,7 +87736,7 @@ var ts;
87700
87736
  return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine);
87701
87737
  case 293 /* AssertEntry */:
87702
87738
  ts.Debug.type(node);
87703
- return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isStringLiteral));
87739
+ return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode));
87704
87740
  case 266 /* ImportClause */:
87705
87741
  ts.Debug.type(node);
87706
87742
  return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings));
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.6.0-dev.20220120",
5
+ "version": "4.6.0-dev.20220124",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -93,7 +93,7 @@
93
93
  "q": "latest",
94
94
  "source-map-support": "latest",
95
95
  "through2": "latest",
96
- "typescript": "^4.2.3",
96
+ "typescript": "^4.5.5",
97
97
  "vinyl": "latest",
98
98
  "vinyl-sourcemaps-apply": "latest",
99
99
  "xml2js": "^0.4.19"