typescript 4.6.0-dev.20220120 → 4.6.0-dev.20220121
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 +26 -7
- package/lib/tsserver.js +35 -11
- package/lib/tsserverlibrary.d.ts +3 -3
- package/lib/tsserverlibrary.js +35 -11
- package/lib/typescript.d.ts +3 -3
- package/lib/typescript.js +35 -11
- package/lib/typescriptServices.d.ts +3 -3
- package/lib/typescriptServices.js +35 -11
- package/lib/typingsInstaller.js +27 -7
- package/package.json +2 -2
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.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220121";
|
|
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 =
|
|
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
|
|
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);
|
|
@@ -65278,7 +65286,7 @@ var ts;
|
|
|
65278
65286
|
}
|
|
65279
65287
|
}
|
|
65280
65288
|
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 });
|
|
65289
|
+
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
65290
|
var saveCurrentNode = currentNode;
|
|
65283
65291
|
currentNode = node;
|
|
65284
65292
|
instantiationCount = 0;
|
|
@@ -67607,7 +67615,7 @@ var ts;
|
|
|
67607
67615
|
return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags);
|
|
67608
67616
|
}
|
|
67609
67617
|
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 });
|
|
67618
|
+
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
67619
|
checkGrammarVariableDeclaration(node);
|
|
67612
67620
|
checkVariableLikeDeclaration(node);
|
|
67613
67621
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -69596,6 +69604,17 @@ var ts;
|
|
|
69596
69604
|
return false;
|
|
69597
69605
|
}
|
|
69598
69606
|
}
|
|
69607
|
+
if (!ts.isImportEqualsDeclaration(node) && node.assertClause) {
|
|
69608
|
+
var hasError = false;
|
|
69609
|
+
for (var _i = 0, _a = node.assertClause.elements; _i < _a.length; _i++) {
|
|
69610
|
+
var clause = _a[_i];
|
|
69611
|
+
if (!ts.isStringLiteral(clause.value)) {
|
|
69612
|
+
hasError = true;
|
|
69613
|
+
error(clause.value, ts.Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
|
|
69614
|
+
}
|
|
69615
|
+
}
|
|
69616
|
+
return !hasError;
|
|
69617
|
+
}
|
|
69599
69618
|
return true;
|
|
69600
69619
|
}
|
|
69601
69620
|
function checkAliasSymbol(node) {
|
|
@@ -70231,7 +70250,7 @@ var ts;
|
|
|
70231
70250
|
}
|
|
70232
70251
|
}
|
|
70233
70252
|
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 });
|
|
70253
|
+
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
70254
|
var saveCurrentNode = currentNode;
|
|
70236
70255
|
currentNode = node;
|
|
70237
70256
|
instantiationCount = 0;
|
|
@@ -73811,7 +73830,7 @@ var ts;
|
|
|
73811
73830
|
return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine);
|
|
73812
73831
|
case 293:
|
|
73813
73832
|
ts.Debug.type(node);
|
|
73814
|
-
return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.
|
|
73833
|
+
return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode));
|
|
73815
73834
|
case 266:
|
|
73816
73835
|
ts.Debug.type(node);
|
|
73817
73836
|
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.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220121";
|
|
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 =
|
|
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:
|
|
@@ -49845,8 +49848,14 @@ var ts;
|
|
|
49845
49848
|
var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
49846
49849
|
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
49847
49850
|
var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
49848
|
-
var sourceFile = resolvedModule
|
|
49851
|
+
var sourceFile = resolvedModule
|
|
49852
|
+
&& (!resolutionDiagnostic || resolutionDiagnostic === ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set)
|
|
49853
|
+
&& host.getSourceFile(resolvedModule.resolvedFileName);
|
|
49849
49854
|
if (sourceFile) {
|
|
49855
|
+
// If there's a resolutionDiagnostic we need to report it even if a sourceFile is found.
|
|
49856
|
+
if (resolutionDiagnostic) {
|
|
49857
|
+
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
49858
|
+
}
|
|
49850
49859
|
if (sourceFile.symbol) {
|
|
49851
49860
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
49852
49861
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
@@ -77935,7 +77944,7 @@ var ts;
|
|
|
77935
77944
|
}
|
|
77936
77945
|
}
|
|
77937
77946
|
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 });
|
|
77947
|
+
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
77948
|
var saveCurrentNode = currentNode;
|
|
77940
77949
|
currentNode = node;
|
|
77941
77950
|
instantiationCount = 0;
|
|
@@ -80694,7 +80703,7 @@ var ts;
|
|
|
80694
80703
|
return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags);
|
|
80695
80704
|
}
|
|
80696
80705
|
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 });
|
|
80706
|
+
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
80707
|
checkGrammarVariableDeclaration(node);
|
|
80699
80708
|
checkVariableLikeDeclaration(node);
|
|
80700
80709
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -83084,6 +83093,17 @@ var ts;
|
|
|
83084
83093
|
return false;
|
|
83085
83094
|
}
|
|
83086
83095
|
}
|
|
83096
|
+
if (!ts.isImportEqualsDeclaration(node) && node.assertClause) {
|
|
83097
|
+
var hasError = false;
|
|
83098
|
+
for (var _i = 0, _a = node.assertClause.elements; _i < _a.length; _i++) {
|
|
83099
|
+
var clause = _a[_i];
|
|
83100
|
+
if (!ts.isStringLiteral(clause.value)) {
|
|
83101
|
+
hasError = true;
|
|
83102
|
+
error(clause.value, ts.Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
|
|
83103
|
+
}
|
|
83104
|
+
}
|
|
83105
|
+
return !hasError;
|
|
83106
|
+
}
|
|
83087
83107
|
return true;
|
|
83088
83108
|
}
|
|
83089
83109
|
function checkAliasSymbol(node) {
|
|
@@ -83777,7 +83797,7 @@ var ts;
|
|
|
83777
83797
|
}
|
|
83778
83798
|
}
|
|
83779
83799
|
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 });
|
|
83800
|
+
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
83801
|
var saveCurrentNode = currentNode;
|
|
83782
83802
|
currentNode = node;
|
|
83783
83803
|
instantiationCount = 0;
|
|
@@ -87711,7 +87731,7 @@ var ts;
|
|
|
87711
87731
|
return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine);
|
|
87712
87732
|
case 293 /* AssertEntry */:
|
|
87713
87733
|
ts.Debug.type(node);
|
|
87714
|
-
return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.
|
|
87734
|
+
return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode));
|
|
87715
87735
|
case 266 /* ImportClause */:
|
|
87716
87736
|
ts.Debug.type(node);
|
|
87717
87737
|
return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings));
|
|
@@ -133739,7 +133759,7 @@ var ts;
|
|
|
133739
133759
|
function getTextSpan(node, sourceFile, endNode) {
|
|
133740
133760
|
var start = node.getStart(sourceFile);
|
|
133741
133761
|
var end = (endNode || node).getEnd();
|
|
133742
|
-
if (ts.isStringLiteralLike(node)) {
|
|
133762
|
+
if (ts.isStringLiteralLike(node) && (end - start) > 2) {
|
|
133743
133763
|
ts.Debug.assert(endNode === undefined);
|
|
133744
133764
|
start += 1;
|
|
133745
133765
|
end -= 1;
|
|
@@ -137059,7 +137079,7 @@ var ts;
|
|
|
137059
137079
|
textSpan: ts.createTextSpanFromNode(declaration),
|
|
137060
137080
|
// TODO(jfreeman): What should be the containerName when the container has a computed name?
|
|
137061
137081
|
containerName: containerName ? containerName.text : "",
|
|
137062
|
-
containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */,
|
|
137082
|
+
containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */,
|
|
137063
137083
|
};
|
|
137064
137084
|
}
|
|
137065
137085
|
})(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {}));
|
|
@@ -150185,7 +150205,7 @@ var ts;
|
|
|
150185
150205
|
var errorCodes = [ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];
|
|
150186
150206
|
codefix.registerCodeFix({
|
|
150187
150207
|
errorCodes: errorCodes,
|
|
150188
|
-
getCodeActions: function (context) {
|
|
150208
|
+
getCodeActions: function getCodeActionsToFixImplicitThis(context) {
|
|
150189
150209
|
var sourceFile = context.sourceFile, program = context.program, span = context.span;
|
|
150190
150210
|
var diagnostic;
|
|
150191
150211
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
@@ -150200,7 +150220,8 @@ var ts;
|
|
|
150200
150220
|
});
|
|
150201
150221
|
function doChange(changes, sourceFile, pos, checker) {
|
|
150202
150222
|
var token = ts.getTokenAtPosition(sourceFile, pos);
|
|
150203
|
-
ts.
|
|
150223
|
+
if (!ts.isThis(token))
|
|
150224
|
+
return undefined;
|
|
150204
150225
|
var fn = ts.getThisContainer(token, /*includeArrowFunctions*/ false);
|
|
150205
150226
|
if (!ts.isFunctionDeclaration(fn) && !ts.isFunctionExpression(fn))
|
|
150206
150227
|
return undefined;
|
|
@@ -152010,6 +152031,9 @@ var ts;
|
|
|
152010
152031
|
codefix.registerCodeFix({
|
|
152011
152032
|
errorCodes: errorCodes,
|
|
152012
152033
|
getCodeActions: function (context) {
|
|
152034
|
+
var syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
|
|
152035
|
+
if (syntacticDiagnostics.length)
|
|
152036
|
+
return;
|
|
152013
152037
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, context.span.start, context.span.length, context.errorCode); });
|
|
152014
152038
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Remove_unreachable_code, fixId, ts.Diagnostics.Remove_all_unreachable_code)];
|
|
152015
152039
|
},
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -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:
|
|
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:
|
|
3580
|
-
updateAssertEntry(node: AssertEntry, name: AssertionKey, value:
|
|
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/tsserverlibrary.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.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220121";
|
|
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 =
|
|
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:
|
|
@@ -50039,8 +50042,14 @@ var ts;
|
|
|
50039
50042
|
var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
50040
50043
|
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
50041
50044
|
var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
50042
|
-
var sourceFile = resolvedModule
|
|
50045
|
+
var sourceFile = resolvedModule
|
|
50046
|
+
&& (!resolutionDiagnostic || resolutionDiagnostic === ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set)
|
|
50047
|
+
&& host.getSourceFile(resolvedModule.resolvedFileName);
|
|
50043
50048
|
if (sourceFile) {
|
|
50049
|
+
// If there's a resolutionDiagnostic we need to report it even if a sourceFile is found.
|
|
50050
|
+
if (resolutionDiagnostic) {
|
|
50051
|
+
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
50052
|
+
}
|
|
50044
50053
|
if (sourceFile.symbol) {
|
|
50045
50054
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
50046
50055
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
@@ -78129,7 +78138,7 @@ var ts;
|
|
|
78129
78138
|
}
|
|
78130
78139
|
}
|
|
78131
78140
|
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 });
|
|
78141
|
+
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
78142
|
var saveCurrentNode = currentNode;
|
|
78134
78143
|
currentNode = node;
|
|
78135
78144
|
instantiationCount = 0;
|
|
@@ -80888,7 +80897,7 @@ var ts;
|
|
|
80888
80897
|
return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags);
|
|
80889
80898
|
}
|
|
80890
80899
|
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 });
|
|
80900
|
+
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
80901
|
checkGrammarVariableDeclaration(node);
|
|
80893
80902
|
checkVariableLikeDeclaration(node);
|
|
80894
80903
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -83278,6 +83287,17 @@ var ts;
|
|
|
83278
83287
|
return false;
|
|
83279
83288
|
}
|
|
83280
83289
|
}
|
|
83290
|
+
if (!ts.isImportEqualsDeclaration(node) && node.assertClause) {
|
|
83291
|
+
var hasError = false;
|
|
83292
|
+
for (var _i = 0, _a = node.assertClause.elements; _i < _a.length; _i++) {
|
|
83293
|
+
var clause = _a[_i];
|
|
83294
|
+
if (!ts.isStringLiteral(clause.value)) {
|
|
83295
|
+
hasError = true;
|
|
83296
|
+
error(clause.value, ts.Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
|
|
83297
|
+
}
|
|
83298
|
+
}
|
|
83299
|
+
return !hasError;
|
|
83300
|
+
}
|
|
83281
83301
|
return true;
|
|
83282
83302
|
}
|
|
83283
83303
|
function checkAliasSymbol(node) {
|
|
@@ -83971,7 +83991,7 @@ var ts;
|
|
|
83971
83991
|
}
|
|
83972
83992
|
}
|
|
83973
83993
|
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 });
|
|
83994
|
+
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
83995
|
var saveCurrentNode = currentNode;
|
|
83976
83996
|
currentNode = node;
|
|
83977
83997
|
instantiationCount = 0;
|
|
@@ -87905,7 +87925,7 @@ var ts;
|
|
|
87905
87925
|
return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine);
|
|
87906
87926
|
case 293 /* AssertEntry */:
|
|
87907
87927
|
ts.Debug.type(node);
|
|
87908
|
-
return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.
|
|
87928
|
+
return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode));
|
|
87909
87929
|
case 266 /* ImportClause */:
|
|
87910
87930
|
ts.Debug.type(node);
|
|
87911
87931
|
return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings));
|
|
@@ -134350,7 +134370,7 @@ var ts;
|
|
|
134350
134370
|
function getTextSpan(node, sourceFile, endNode) {
|
|
134351
134371
|
var start = node.getStart(sourceFile);
|
|
134352
134372
|
var end = (endNode || node).getEnd();
|
|
134353
|
-
if (ts.isStringLiteralLike(node)) {
|
|
134373
|
+
if (ts.isStringLiteralLike(node) && (end - start) > 2) {
|
|
134354
134374
|
ts.Debug.assert(endNode === undefined);
|
|
134355
134375
|
start += 1;
|
|
134356
134376
|
end -= 1;
|
|
@@ -137670,7 +137690,7 @@ var ts;
|
|
|
137670
137690
|
textSpan: ts.createTextSpanFromNode(declaration),
|
|
137671
137691
|
// TODO(jfreeman): What should be the containerName when the container has a computed name?
|
|
137672
137692
|
containerName: containerName ? containerName.text : "",
|
|
137673
|
-
containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */,
|
|
137693
|
+
containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */,
|
|
137674
137694
|
};
|
|
137675
137695
|
}
|
|
137676
137696
|
})(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {}));
|
|
@@ -150796,7 +150816,7 @@ var ts;
|
|
|
150796
150816
|
var errorCodes = [ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];
|
|
150797
150817
|
codefix.registerCodeFix({
|
|
150798
150818
|
errorCodes: errorCodes,
|
|
150799
|
-
getCodeActions: function (context) {
|
|
150819
|
+
getCodeActions: function getCodeActionsToFixImplicitThis(context) {
|
|
150800
150820
|
var sourceFile = context.sourceFile, program = context.program, span = context.span;
|
|
150801
150821
|
var diagnostic;
|
|
150802
150822
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
@@ -150811,7 +150831,8 @@ var ts;
|
|
|
150811
150831
|
});
|
|
150812
150832
|
function doChange(changes, sourceFile, pos, checker) {
|
|
150813
150833
|
var token = ts.getTokenAtPosition(sourceFile, pos);
|
|
150814
|
-
ts.
|
|
150834
|
+
if (!ts.isThis(token))
|
|
150835
|
+
return undefined;
|
|
150815
150836
|
var fn = ts.getThisContainer(token, /*includeArrowFunctions*/ false);
|
|
150816
150837
|
if (!ts.isFunctionDeclaration(fn) && !ts.isFunctionExpression(fn))
|
|
150817
150838
|
return undefined;
|
|
@@ -152621,6 +152642,9 @@ var ts;
|
|
|
152621
152642
|
codefix.registerCodeFix({
|
|
152622
152643
|
errorCodes: errorCodes,
|
|
152623
152644
|
getCodeActions: function (context) {
|
|
152645
|
+
var syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
|
|
152646
|
+
if (syntacticDiagnostics.length)
|
|
152647
|
+
return;
|
|
152624
152648
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, context.span.start, context.span.length, context.errorCode); });
|
|
152625
152649
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Remove_unreachable_code, fixId, ts.Diagnostics.Remove_all_unreachable_code)];
|
|
152626
152650
|
},
|
package/lib/typescript.d.ts
CHANGED
|
@@ -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:
|
|
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:
|
|
3580
|
-
updateAssertEntry(node: AssertEntry, name: AssertionKey, value:
|
|
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.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220121";
|
|
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 =
|
|
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:
|
|
@@ -50039,8 +50042,14 @@ var ts;
|
|
|
50039
50042
|
var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
50040
50043
|
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
50041
50044
|
var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
50042
|
-
var sourceFile = resolvedModule
|
|
50045
|
+
var sourceFile = resolvedModule
|
|
50046
|
+
&& (!resolutionDiagnostic || resolutionDiagnostic === ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set)
|
|
50047
|
+
&& host.getSourceFile(resolvedModule.resolvedFileName);
|
|
50043
50048
|
if (sourceFile) {
|
|
50049
|
+
// If there's a resolutionDiagnostic we need to report it even if a sourceFile is found.
|
|
50050
|
+
if (resolutionDiagnostic) {
|
|
50051
|
+
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
50052
|
+
}
|
|
50044
50053
|
if (sourceFile.symbol) {
|
|
50045
50054
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
50046
50055
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
@@ -78129,7 +78138,7 @@ var ts;
|
|
|
78129
78138
|
}
|
|
78130
78139
|
}
|
|
78131
78140
|
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 });
|
|
78141
|
+
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
78142
|
var saveCurrentNode = currentNode;
|
|
78134
78143
|
currentNode = node;
|
|
78135
78144
|
instantiationCount = 0;
|
|
@@ -80888,7 +80897,7 @@ var ts;
|
|
|
80888
80897
|
return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags);
|
|
80889
80898
|
}
|
|
80890
80899
|
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 });
|
|
80900
|
+
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
80901
|
checkGrammarVariableDeclaration(node);
|
|
80893
80902
|
checkVariableLikeDeclaration(node);
|
|
80894
80903
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -83278,6 +83287,17 @@ var ts;
|
|
|
83278
83287
|
return false;
|
|
83279
83288
|
}
|
|
83280
83289
|
}
|
|
83290
|
+
if (!ts.isImportEqualsDeclaration(node) && node.assertClause) {
|
|
83291
|
+
var hasError = false;
|
|
83292
|
+
for (var _i = 0, _a = node.assertClause.elements; _i < _a.length; _i++) {
|
|
83293
|
+
var clause = _a[_i];
|
|
83294
|
+
if (!ts.isStringLiteral(clause.value)) {
|
|
83295
|
+
hasError = true;
|
|
83296
|
+
error(clause.value, ts.Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
|
|
83297
|
+
}
|
|
83298
|
+
}
|
|
83299
|
+
return !hasError;
|
|
83300
|
+
}
|
|
83281
83301
|
return true;
|
|
83282
83302
|
}
|
|
83283
83303
|
function checkAliasSymbol(node) {
|
|
@@ -83971,7 +83991,7 @@ var ts;
|
|
|
83971
83991
|
}
|
|
83972
83992
|
}
|
|
83973
83993
|
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 });
|
|
83994
|
+
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
83995
|
var saveCurrentNode = currentNode;
|
|
83976
83996
|
currentNode = node;
|
|
83977
83997
|
instantiationCount = 0;
|
|
@@ -87905,7 +87925,7 @@ var ts;
|
|
|
87905
87925
|
return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine);
|
|
87906
87926
|
case 293 /* AssertEntry */:
|
|
87907
87927
|
ts.Debug.type(node);
|
|
87908
|
-
return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.
|
|
87928
|
+
return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode));
|
|
87909
87929
|
case 266 /* ImportClause */:
|
|
87910
87930
|
ts.Debug.type(node);
|
|
87911
87931
|
return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings));
|
|
@@ -134350,7 +134370,7 @@ var ts;
|
|
|
134350
134370
|
function getTextSpan(node, sourceFile, endNode) {
|
|
134351
134371
|
var start = node.getStart(sourceFile);
|
|
134352
134372
|
var end = (endNode || node).getEnd();
|
|
134353
|
-
if (ts.isStringLiteralLike(node)) {
|
|
134373
|
+
if (ts.isStringLiteralLike(node) && (end - start) > 2) {
|
|
134354
134374
|
ts.Debug.assert(endNode === undefined);
|
|
134355
134375
|
start += 1;
|
|
134356
134376
|
end -= 1;
|
|
@@ -137670,7 +137690,7 @@ var ts;
|
|
|
137670
137690
|
textSpan: ts.createTextSpanFromNode(declaration),
|
|
137671
137691
|
// TODO(jfreeman): What should be the containerName when the container has a computed name?
|
|
137672
137692
|
containerName: containerName ? containerName.text : "",
|
|
137673
|
-
containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */,
|
|
137693
|
+
containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */,
|
|
137674
137694
|
};
|
|
137675
137695
|
}
|
|
137676
137696
|
})(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {}));
|
|
@@ -150796,7 +150816,7 @@ var ts;
|
|
|
150796
150816
|
var errorCodes = [ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];
|
|
150797
150817
|
codefix.registerCodeFix({
|
|
150798
150818
|
errorCodes: errorCodes,
|
|
150799
|
-
getCodeActions: function (context) {
|
|
150819
|
+
getCodeActions: function getCodeActionsToFixImplicitThis(context) {
|
|
150800
150820
|
var sourceFile = context.sourceFile, program = context.program, span = context.span;
|
|
150801
150821
|
var diagnostic;
|
|
150802
150822
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
@@ -150811,7 +150831,8 @@ var ts;
|
|
|
150811
150831
|
});
|
|
150812
150832
|
function doChange(changes, sourceFile, pos, checker) {
|
|
150813
150833
|
var token = ts.getTokenAtPosition(sourceFile, pos);
|
|
150814
|
-
ts.
|
|
150834
|
+
if (!ts.isThis(token))
|
|
150835
|
+
return undefined;
|
|
150815
150836
|
var fn = ts.getThisContainer(token, /*includeArrowFunctions*/ false);
|
|
150816
150837
|
if (!ts.isFunctionDeclaration(fn) && !ts.isFunctionExpression(fn))
|
|
150817
150838
|
return undefined;
|
|
@@ -152621,6 +152642,9 @@ var ts;
|
|
|
152621
152642
|
codefix.registerCodeFix({
|
|
152622
152643
|
errorCodes: errorCodes,
|
|
152623
152644
|
getCodeActions: function (context) {
|
|
152645
|
+
var syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
|
|
152646
|
+
if (syntacticDiagnostics.length)
|
|
152647
|
+
return;
|
|
152624
152648
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, context.span.start, context.span.length, context.errorCode); });
|
|
152625
152649
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Remove_unreachable_code, fixId, ts.Diagnostics.Remove_all_unreachable_code)];
|
|
152626
152650
|
},
|
|
@@ -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:
|
|
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:
|
|
3580
|
-
updateAssertEntry(node: AssertEntry, name: AssertionKey, value:
|
|
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.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220121";
|
|
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 =
|
|
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:
|
|
@@ -50039,8 +50042,14 @@ var ts;
|
|
|
50039
50042
|
var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
50040
50043
|
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
50041
50044
|
var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
50042
|
-
var sourceFile = resolvedModule
|
|
50045
|
+
var sourceFile = resolvedModule
|
|
50046
|
+
&& (!resolutionDiagnostic || resolutionDiagnostic === ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set)
|
|
50047
|
+
&& host.getSourceFile(resolvedModule.resolvedFileName);
|
|
50043
50048
|
if (sourceFile) {
|
|
50049
|
+
// If there's a resolutionDiagnostic we need to report it even if a sourceFile is found.
|
|
50050
|
+
if (resolutionDiagnostic) {
|
|
50051
|
+
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
50052
|
+
}
|
|
50044
50053
|
if (sourceFile.symbol) {
|
|
50045
50054
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
50046
50055
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
@@ -78129,7 +78138,7 @@ var ts;
|
|
|
78129
78138
|
}
|
|
78130
78139
|
}
|
|
78131
78140
|
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 });
|
|
78141
|
+
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
78142
|
var saveCurrentNode = currentNode;
|
|
78134
78143
|
currentNode = node;
|
|
78135
78144
|
instantiationCount = 0;
|
|
@@ -80888,7 +80897,7 @@ var ts;
|
|
|
80888
80897
|
return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags);
|
|
80889
80898
|
}
|
|
80890
80899
|
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 });
|
|
80900
|
+
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
80901
|
checkGrammarVariableDeclaration(node);
|
|
80893
80902
|
checkVariableLikeDeclaration(node);
|
|
80894
80903
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -83278,6 +83287,17 @@ var ts;
|
|
|
83278
83287
|
return false;
|
|
83279
83288
|
}
|
|
83280
83289
|
}
|
|
83290
|
+
if (!ts.isImportEqualsDeclaration(node) && node.assertClause) {
|
|
83291
|
+
var hasError = false;
|
|
83292
|
+
for (var _i = 0, _a = node.assertClause.elements; _i < _a.length; _i++) {
|
|
83293
|
+
var clause = _a[_i];
|
|
83294
|
+
if (!ts.isStringLiteral(clause.value)) {
|
|
83295
|
+
hasError = true;
|
|
83296
|
+
error(clause.value, ts.Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
|
|
83297
|
+
}
|
|
83298
|
+
}
|
|
83299
|
+
return !hasError;
|
|
83300
|
+
}
|
|
83281
83301
|
return true;
|
|
83282
83302
|
}
|
|
83283
83303
|
function checkAliasSymbol(node) {
|
|
@@ -83971,7 +83991,7 @@ var ts;
|
|
|
83971
83991
|
}
|
|
83972
83992
|
}
|
|
83973
83993
|
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 });
|
|
83994
|
+
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
83995
|
var saveCurrentNode = currentNode;
|
|
83976
83996
|
currentNode = node;
|
|
83977
83997
|
instantiationCount = 0;
|
|
@@ -87905,7 +87925,7 @@ var ts;
|
|
|
87905
87925
|
return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine);
|
|
87906
87926
|
case 293 /* AssertEntry */:
|
|
87907
87927
|
ts.Debug.type(node);
|
|
87908
|
-
return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.
|
|
87928
|
+
return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode));
|
|
87909
87929
|
case 266 /* ImportClause */:
|
|
87910
87930
|
ts.Debug.type(node);
|
|
87911
87931
|
return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings));
|
|
@@ -134350,7 +134370,7 @@ var ts;
|
|
|
134350
134370
|
function getTextSpan(node, sourceFile, endNode) {
|
|
134351
134371
|
var start = node.getStart(sourceFile);
|
|
134352
134372
|
var end = (endNode || node).getEnd();
|
|
134353
|
-
if (ts.isStringLiteralLike(node)) {
|
|
134373
|
+
if (ts.isStringLiteralLike(node) && (end - start) > 2) {
|
|
134354
134374
|
ts.Debug.assert(endNode === undefined);
|
|
134355
134375
|
start += 1;
|
|
134356
134376
|
end -= 1;
|
|
@@ -137670,7 +137690,7 @@ var ts;
|
|
|
137670
137690
|
textSpan: ts.createTextSpanFromNode(declaration),
|
|
137671
137691
|
// TODO(jfreeman): What should be the containerName when the container has a computed name?
|
|
137672
137692
|
containerName: containerName ? containerName.text : "",
|
|
137673
|
-
containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */,
|
|
137693
|
+
containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */,
|
|
137674
137694
|
};
|
|
137675
137695
|
}
|
|
137676
137696
|
})(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {}));
|
|
@@ -150796,7 +150816,7 @@ var ts;
|
|
|
150796
150816
|
var errorCodes = [ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];
|
|
150797
150817
|
codefix.registerCodeFix({
|
|
150798
150818
|
errorCodes: errorCodes,
|
|
150799
|
-
getCodeActions: function (context) {
|
|
150819
|
+
getCodeActions: function getCodeActionsToFixImplicitThis(context) {
|
|
150800
150820
|
var sourceFile = context.sourceFile, program = context.program, span = context.span;
|
|
150801
150821
|
var diagnostic;
|
|
150802
150822
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
@@ -150811,7 +150831,8 @@ var ts;
|
|
|
150811
150831
|
});
|
|
150812
150832
|
function doChange(changes, sourceFile, pos, checker) {
|
|
150813
150833
|
var token = ts.getTokenAtPosition(sourceFile, pos);
|
|
150814
|
-
ts.
|
|
150834
|
+
if (!ts.isThis(token))
|
|
150835
|
+
return undefined;
|
|
150815
150836
|
var fn = ts.getThisContainer(token, /*includeArrowFunctions*/ false);
|
|
150816
150837
|
if (!ts.isFunctionDeclaration(fn) && !ts.isFunctionExpression(fn))
|
|
150817
150838
|
return undefined;
|
|
@@ -152621,6 +152642,9 @@ var ts;
|
|
|
152621
152642
|
codefix.registerCodeFix({
|
|
152622
152643
|
errorCodes: errorCodes,
|
|
152623
152644
|
getCodeActions: function (context) {
|
|
152645
|
+
var syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
|
|
152646
|
+
if (syntacticDiagnostics.length)
|
|
152647
|
+
return;
|
|
152624
152648
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, context.span.start, context.span.length, context.errorCode); });
|
|
152625
152649
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Remove_unreachable_code, fixId, ts.Diagnostics.Remove_all_unreachable_code)];
|
|
152626
152650
|
},
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -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.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220121";
|
|
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 =
|
|
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:
|
|
@@ -49834,8 +49837,14 @@ var ts;
|
|
|
49834
49837
|
var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
49835
49838
|
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
49836
49839
|
var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
49837
|
-
var sourceFile = resolvedModule
|
|
49840
|
+
var sourceFile = resolvedModule
|
|
49841
|
+
&& (!resolutionDiagnostic || resolutionDiagnostic === ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set)
|
|
49842
|
+
&& host.getSourceFile(resolvedModule.resolvedFileName);
|
|
49838
49843
|
if (sourceFile) {
|
|
49844
|
+
// If there's a resolutionDiagnostic we need to report it even if a sourceFile is found.
|
|
49845
|
+
if (resolutionDiagnostic) {
|
|
49846
|
+
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
49847
|
+
}
|
|
49839
49848
|
if (sourceFile.symbol) {
|
|
49840
49849
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
49841
49850
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
@@ -77924,7 +77933,7 @@ var ts;
|
|
|
77924
77933
|
}
|
|
77925
77934
|
}
|
|
77926
77935
|
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 });
|
|
77936
|
+
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
77937
|
var saveCurrentNode = currentNode;
|
|
77929
77938
|
currentNode = node;
|
|
77930
77939
|
instantiationCount = 0;
|
|
@@ -80683,7 +80692,7 @@ var ts;
|
|
|
80683
80692
|
return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags);
|
|
80684
80693
|
}
|
|
80685
80694
|
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 });
|
|
80695
|
+
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
80696
|
checkGrammarVariableDeclaration(node);
|
|
80688
80697
|
checkVariableLikeDeclaration(node);
|
|
80689
80698
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -83073,6 +83082,17 @@ var ts;
|
|
|
83073
83082
|
return false;
|
|
83074
83083
|
}
|
|
83075
83084
|
}
|
|
83085
|
+
if (!ts.isImportEqualsDeclaration(node) && node.assertClause) {
|
|
83086
|
+
var hasError = false;
|
|
83087
|
+
for (var _i = 0, _a = node.assertClause.elements; _i < _a.length; _i++) {
|
|
83088
|
+
var clause = _a[_i];
|
|
83089
|
+
if (!ts.isStringLiteral(clause.value)) {
|
|
83090
|
+
hasError = true;
|
|
83091
|
+
error(clause.value, ts.Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
|
|
83092
|
+
}
|
|
83093
|
+
}
|
|
83094
|
+
return !hasError;
|
|
83095
|
+
}
|
|
83076
83096
|
return true;
|
|
83077
83097
|
}
|
|
83078
83098
|
function checkAliasSymbol(node) {
|
|
@@ -83766,7 +83786,7 @@ var ts;
|
|
|
83766
83786
|
}
|
|
83767
83787
|
}
|
|
83768
83788
|
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 });
|
|
83789
|
+
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
83790
|
var saveCurrentNode = currentNode;
|
|
83771
83791
|
currentNode = node;
|
|
83772
83792
|
instantiationCount = 0;
|
|
@@ -87700,7 +87720,7 @@ var ts;
|
|
|
87700
87720
|
return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine);
|
|
87701
87721
|
case 293 /* AssertEntry */:
|
|
87702
87722
|
ts.Debug.type(node);
|
|
87703
|
-
return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.
|
|
87723
|
+
return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode));
|
|
87704
87724
|
case 266 /* ImportClause */:
|
|
87705
87725
|
ts.Debug.type(node);
|
|
87706
87726
|
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.
|
|
5
|
+
"version": "4.6.0-dev.20220121",
|
|
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.
|
|
96
|
+
"typescript": "^4.5.5",
|
|
97
97
|
"vinyl": "latest",
|
|
98
98
|
"vinyl-sourcemaps-apply": "latest",
|
|
99
99
|
"xml2js": "^0.4.19"
|