typescript 5.0.0-dev.20221229 → 5.0.0-dev.20221231
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 +20 -8
- package/lib/tsserver.js +39 -11
- package/lib/tsserverlibrary.js +39 -11
- package/lib/typescript.js +39 -11
- package/lib/typingsInstaller.js +3 -1
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.0";
|
|
26
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
26
|
+
var version = `${versionMajorMinor}.0-dev.20221231`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -7208,6 +7208,8 @@ var Diagnostics = {
|
|
|
7208
7208
|
The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option: diag(17016, 1 /* Error */, "The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_com_17016", "The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option."),
|
|
7209
7209
|
An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments: diag(17017, 1 /* Error */, "An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments_17017", "An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments."),
|
|
7210
7210
|
Unknown_type_acquisition_option_0_Did_you_mean_1: diag(17018, 1 /* Error */, "Unknown_type_acquisition_option_0_Did_you_mean_1_17018", "Unknown type acquisition option '{0}'. Did you mean '{1}'?"),
|
|
7211
|
+
_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17019, 1 /* Error */, "_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17019", "'{0}' at the end of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
|
|
7212
|
+
_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17020, 1 /* Error */, "_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17020", "'{0}' at the start of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
|
|
7211
7213
|
Circularity_detected_while_resolving_configuration_Colon_0: diag(18e3, 1 /* Error */, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"),
|
|
7212
7214
|
The_files_list_in_config_file_0_is_empty: diag(18002, 1 /* Error */, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."),
|
|
7213
7215
|
No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: diag(18003, 1 /* Error */, "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."),
|
|
@@ -40171,7 +40173,7 @@ function createTypeChecker(host) {
|
|
|
40171
40173
|
if (usage.kind === 274 /* ExportAssignment */ && usage.isExportEquals) {
|
|
40172
40174
|
return true;
|
|
40173
40175
|
}
|
|
40174
|
-
if (!!(usage.flags & 8388608 /* JSDoc */) || isInTypeQuery(usage) ||
|
|
40176
|
+
if (!!(usage.flags & 8388608 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
|
|
40175
40177
|
return true;
|
|
40176
40178
|
}
|
|
40177
40179
|
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
|
@@ -40182,9 +40184,6 @@ function createTypeChecker(host) {
|
|
|
40182
40184
|
}
|
|
40183
40185
|
}
|
|
40184
40186
|
return false;
|
|
40185
|
-
function usageInTypeDeclaration() {
|
|
40186
|
-
return !!findAncestor(usage, (node) => isInterfaceDeclaration(node) || isTypeAliasDeclaration(node));
|
|
40187
|
-
}
|
|
40188
40187
|
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration2, usage2) {
|
|
40189
40188
|
switch (declaration2.parent.parent.kind) {
|
|
40190
40189
|
case 240 /* VariableStatement */:
|
|
@@ -56891,6 +56890,9 @@ function createTypeChecker(host) {
|
|
|
56891
56890
|
(n) => n.kind === 183 /* TypeQuery */ ? true : n.kind === 79 /* Identifier */ || n.kind === 163 /* QualifiedName */ ? false : "quit"
|
|
56892
56891
|
);
|
|
56893
56892
|
}
|
|
56893
|
+
function isInAmbientOrTypeNode(node) {
|
|
56894
|
+
return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeLiteralNode(n)));
|
|
56895
|
+
}
|
|
56894
56896
|
function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
|
|
56895
56897
|
switch (node.kind) {
|
|
56896
56898
|
case 79 /* Identifier */:
|
|
@@ -58578,7 +58580,7 @@ function createTypeChecker(host) {
|
|
|
58578
58580
|
return type;
|
|
58579
58581
|
}
|
|
58580
58582
|
function narrowType(type, expr, assumeTrue) {
|
|
58581
|
-
if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && expr.parent.operatorToken.kind === 60 /* QuestionQuestionToken */ && expr.parent.left === expr) {
|
|
58583
|
+
if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && (expr.parent.operatorToken.kind === 60 /* QuestionQuestionToken */ || expr.parent.operatorToken.kind === 77 /* QuestionQuestionEqualsToken */) && expr.parent.left === expr) {
|
|
58582
58584
|
return narrowTypeByOptionality(type, expr, assumeTrue);
|
|
58583
58585
|
}
|
|
58584
58586
|
switch (expr.kind) {
|
|
@@ -58873,7 +58875,7 @@ function createTypeChecker(host) {
|
|
|
58873
58875
|
while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* FunctionExpression */ || flowContainer.kind === 216 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
|
|
58874
58876
|
flowContainer = getControlFlowContainer(flowContainer);
|
|
58875
58877
|
}
|
|
58876
|
-
const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
|
|
58878
|
+
const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
|
|
58877
58879
|
const initialType = assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : type === autoType || type === autoArrayType ? undefinedType : getOptionalType(type);
|
|
58878
58880
|
const flowType = getFlowTypeOfReference(node, type, initialType, flowContainer);
|
|
58879
58881
|
if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
|
|
@@ -70796,7 +70798,17 @@ function createTypeChecker(host) {
|
|
|
70796
70798
|
}
|
|
70797
70799
|
function checkJSDocTypeIsInJsFile(node) {
|
|
70798
70800
|
if (!isInJSFile(node)) {
|
|
70799
|
-
|
|
70801
|
+
if (isJSDocNonNullableType(node) || isJSDocNullableType(node)) {
|
|
70802
|
+
const token = tokenToString(isJSDocNonNullableType(node) ? 53 /* ExclamationToken */ : 57 /* QuestionToken */);
|
|
70803
|
+
const diagnostic = node.postfix ? Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1 : Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1;
|
|
70804
|
+
const typeNode = node.type;
|
|
70805
|
+
const type = getTypeFromTypeNode(typeNode);
|
|
70806
|
+
grammarErrorOnNode(node, diagnostic, token, typeToString(
|
|
70807
|
+
isJSDocNullableType(node) && !(type === neverType || type === voidType) ? getUnionType(append([type, undefinedType], node.postfix ? void 0 : nullType)) : type
|
|
70808
|
+
));
|
|
70809
|
+
} else {
|
|
70810
|
+
grammarErrorOnNode(node, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
|
|
70811
|
+
}
|
|
70800
70812
|
}
|
|
70801
70813
|
}
|
|
70802
70814
|
function checkJSDocVariadicType(node) {
|
package/lib/tsserver.js
CHANGED
|
@@ -2670,7 +2670,7 @@ __export(ts_server_exports3, {
|
|
|
2670
2670
|
|
|
2671
2671
|
// src/compiler/corePublic.ts
|
|
2672
2672
|
var versionMajorMinor = "5.0";
|
|
2673
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2673
|
+
var version = `${versionMajorMinor}.0-dev.20221231`;
|
|
2674
2674
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2675
2675
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2676
2676
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -11156,6 +11156,8 @@ var Diagnostics = {
|
|
|
11156
11156
|
The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option: diag(17016, 1 /* Error */, "The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_com_17016", "The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option."),
|
|
11157
11157
|
An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments: diag(17017, 1 /* Error */, "An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments_17017", "An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments."),
|
|
11158
11158
|
Unknown_type_acquisition_option_0_Did_you_mean_1: diag(17018, 1 /* Error */, "Unknown_type_acquisition_option_0_Did_you_mean_1_17018", "Unknown type acquisition option '{0}'. Did you mean '{1}'?"),
|
|
11159
|
+
_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17019, 1 /* Error */, "_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17019", "'{0}' at the end of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
|
|
11160
|
+
_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17020, 1 /* Error */, "_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17020", "'{0}' at the start of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
|
|
11159
11161
|
Circularity_detected_while_resolving_configuration_Colon_0: diag(18e3, 1 /* Error */, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"),
|
|
11160
11162
|
The_files_list_in_config_file_0_is_empty: diag(18002, 1 /* Error */, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."),
|
|
11161
11163
|
No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: diag(18003, 1 /* Error */, "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."),
|
|
@@ -45147,7 +45149,7 @@ function createTypeChecker(host) {
|
|
|
45147
45149
|
if (usage.kind === 274 /* ExportAssignment */ && usage.isExportEquals) {
|
|
45148
45150
|
return true;
|
|
45149
45151
|
}
|
|
45150
|
-
if (!!(usage.flags & 8388608 /* JSDoc */) || isInTypeQuery(usage) ||
|
|
45152
|
+
if (!!(usage.flags & 8388608 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
|
|
45151
45153
|
return true;
|
|
45152
45154
|
}
|
|
45153
45155
|
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
|
@@ -45158,9 +45160,6 @@ function createTypeChecker(host) {
|
|
|
45158
45160
|
}
|
|
45159
45161
|
}
|
|
45160
45162
|
return false;
|
|
45161
|
-
function usageInTypeDeclaration() {
|
|
45162
|
-
return !!findAncestor(usage, (node) => isInterfaceDeclaration(node) || isTypeAliasDeclaration(node));
|
|
45163
|
-
}
|
|
45164
45163
|
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration2, usage2) {
|
|
45165
45164
|
switch (declaration2.parent.parent.kind) {
|
|
45166
45165
|
case 240 /* VariableStatement */:
|
|
@@ -61867,6 +61866,9 @@ function createTypeChecker(host) {
|
|
|
61867
61866
|
(n) => n.kind === 183 /* TypeQuery */ ? true : n.kind === 79 /* Identifier */ || n.kind === 163 /* QualifiedName */ ? false : "quit"
|
|
61868
61867
|
);
|
|
61869
61868
|
}
|
|
61869
|
+
function isInAmbientOrTypeNode(node) {
|
|
61870
|
+
return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeLiteralNode(n)));
|
|
61871
|
+
}
|
|
61870
61872
|
function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
|
|
61871
61873
|
switch (node.kind) {
|
|
61872
61874
|
case 79 /* Identifier */:
|
|
@@ -63554,7 +63556,7 @@ function createTypeChecker(host) {
|
|
|
63554
63556
|
return type;
|
|
63555
63557
|
}
|
|
63556
63558
|
function narrowType(type, expr, assumeTrue) {
|
|
63557
|
-
if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && expr.parent.operatorToken.kind === 60 /* QuestionQuestionToken */ && expr.parent.left === expr) {
|
|
63559
|
+
if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && (expr.parent.operatorToken.kind === 60 /* QuestionQuestionToken */ || expr.parent.operatorToken.kind === 77 /* QuestionQuestionEqualsToken */) && expr.parent.left === expr) {
|
|
63558
63560
|
return narrowTypeByOptionality(type, expr, assumeTrue);
|
|
63559
63561
|
}
|
|
63560
63562
|
switch (expr.kind) {
|
|
@@ -63849,7 +63851,7 @@ function createTypeChecker(host) {
|
|
|
63849
63851
|
while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* FunctionExpression */ || flowContainer.kind === 216 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
|
|
63850
63852
|
flowContainer = getControlFlowContainer(flowContainer);
|
|
63851
63853
|
}
|
|
63852
|
-
const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
|
|
63854
|
+
const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
|
|
63853
63855
|
const initialType = assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : type === autoType || type === autoArrayType ? undefinedType : getOptionalType(type);
|
|
63854
63856
|
const flowType = getFlowTypeOfReference(node, type, initialType, flowContainer);
|
|
63855
63857
|
if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
|
|
@@ -75772,7 +75774,17 @@ function createTypeChecker(host) {
|
|
|
75772
75774
|
}
|
|
75773
75775
|
function checkJSDocTypeIsInJsFile(node) {
|
|
75774
75776
|
if (!isInJSFile(node)) {
|
|
75775
|
-
|
|
75777
|
+
if (isJSDocNonNullableType(node) || isJSDocNullableType(node)) {
|
|
75778
|
+
const token = tokenToString(isJSDocNonNullableType(node) ? 53 /* ExclamationToken */ : 57 /* QuestionToken */);
|
|
75779
|
+
const diagnostic = node.postfix ? Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1 : Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1;
|
|
75780
|
+
const typeNode = node.type;
|
|
75781
|
+
const type = getTypeFromTypeNode(typeNode);
|
|
75782
|
+
grammarErrorOnNode(node, diagnostic, token, typeToString(
|
|
75783
|
+
isJSDocNullableType(node) && !(type === neverType || type === voidType) ? getUnionType(append([type, undefinedType], node.postfix ? void 0 : nullType)) : type
|
|
75784
|
+
));
|
|
75785
|
+
} else {
|
|
75786
|
+
grammarErrorOnNode(node, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
|
|
75787
|
+
}
|
|
75776
75788
|
}
|
|
75777
75789
|
}
|
|
75778
75790
|
function checkJSDocVariadicType(node) {
|
|
@@ -131780,7 +131792,11 @@ function doChange19(changes, sourceFile, start2) {
|
|
|
131780
131792
|
// src/services/codefixes/fixJSDocTypes.ts
|
|
131781
131793
|
var fixIdPlain = "fixJSDocTypes_plain";
|
|
131782
131794
|
var fixIdNullable = "fixJSDocTypes_nullable";
|
|
131783
|
-
var errorCodes44 = [
|
|
131795
|
+
var errorCodes44 = [
|
|
131796
|
+
Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code,
|
|
131797
|
+
Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code,
|
|
131798
|
+
Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code
|
|
131799
|
+
];
|
|
131784
131800
|
registerCodeFix({
|
|
131785
131801
|
errorCodes: errorCodes44,
|
|
131786
131802
|
getCodeActions(context) {
|
|
@@ -131793,7 +131809,7 @@ registerCodeFix({
|
|
|
131793
131809
|
const original = typeNode.getText(sourceFile);
|
|
131794
131810
|
const actions2 = [fix(type, fixIdPlain, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)];
|
|
131795
131811
|
if (typeNode.kind === 317 /* JSDocNullableType */) {
|
|
131796
|
-
actions2.push(fix(
|
|
131812
|
+
actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
|
|
131797
131813
|
}
|
|
131798
131814
|
return actions2;
|
|
131799
131815
|
function fix(type2, fixId52, fixAllDescription) {
|
|
@@ -131821,7 +131837,7 @@ function doChange20(changes, sourceFile, oldTypeNode, newType, checker) {
|
|
|
131821
131837
|
function getInfo11(sourceFile, pos, checker) {
|
|
131822
131838
|
const decl = findAncestor(getTokenAtPosition(sourceFile, pos), isTypeContainer);
|
|
131823
131839
|
const typeNode = decl && decl.type;
|
|
131824
|
-
return typeNode && { typeNode, type: checker
|
|
131840
|
+
return typeNode && { typeNode, type: getType(checker, typeNode) };
|
|
131825
131841
|
}
|
|
131826
131842
|
function isTypeContainer(node) {
|
|
131827
131843
|
switch (node.kind) {
|
|
@@ -131846,6 +131862,18 @@ function isTypeContainer(node) {
|
|
|
131846
131862
|
return false;
|
|
131847
131863
|
}
|
|
131848
131864
|
}
|
|
131865
|
+
function getType(checker, node) {
|
|
131866
|
+
if (isJSDocNullableType(node)) {
|
|
131867
|
+
const type = checker.getTypeFromTypeNode(node.type);
|
|
131868
|
+
if (type === checker.getNeverType() || type === checker.getVoidType()) {
|
|
131869
|
+
return type;
|
|
131870
|
+
}
|
|
131871
|
+
return checker.getUnionType(
|
|
131872
|
+
append([type, checker.getUndefinedType()], node.postfix ? void 0 : checker.getNullType())
|
|
131873
|
+
);
|
|
131874
|
+
}
|
|
131875
|
+
return checker.getTypeFromTypeNode(node);
|
|
131876
|
+
}
|
|
131849
131877
|
|
|
131850
131878
|
// src/services/codefixes/fixMissingCallParentheses.ts
|
|
131851
131879
|
var fixId35 = "fixMissingCallParentheses";
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -42,7 +42,7 @@ var ts = (() => {
|
|
|
42
42
|
"src/compiler/corePublic.ts"() {
|
|
43
43
|
"use strict";
|
|
44
44
|
versionMajorMinor = "5.0";
|
|
45
|
-
version = `${versionMajorMinor}.0-dev.
|
|
45
|
+
version = `${versionMajorMinor}.0-dev.20221231`;
|
|
46
46
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
47
47
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
48
48
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -8603,6 +8603,8 @@ ${lanes.join("\n")}
|
|
|
8603
8603
|
The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option: diag(17016, 1 /* Error */, "The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_com_17016", "The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option."),
|
|
8604
8604
|
An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments: diag(17017, 1 /* Error */, "An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments_17017", "An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments."),
|
|
8605
8605
|
Unknown_type_acquisition_option_0_Did_you_mean_1: diag(17018, 1 /* Error */, "Unknown_type_acquisition_option_0_Did_you_mean_1_17018", "Unknown type acquisition option '{0}'. Did you mean '{1}'?"),
|
|
8606
|
+
_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17019, 1 /* Error */, "_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17019", "'{0}' at the end of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
|
|
8607
|
+
_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17020, 1 /* Error */, "_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17020", "'{0}' at the start of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
|
|
8606
8608
|
Circularity_detected_while_resolving_configuration_Colon_0: diag(18e3, 1 /* Error */, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"),
|
|
8607
8609
|
The_files_list_in_config_file_0_is_empty: diag(18002, 1 /* Error */, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."),
|
|
8608
8610
|
No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: diag(18003, 1 /* Error */, "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."),
|
|
@@ -42581,7 +42583,7 @@ ${lanes.join("\n")}
|
|
|
42581
42583
|
if (usage.kind === 274 /* ExportAssignment */ && usage.isExportEquals) {
|
|
42582
42584
|
return true;
|
|
42583
42585
|
}
|
|
42584
|
-
if (!!(usage.flags & 8388608 /* JSDoc */) || isInTypeQuery(usage) ||
|
|
42586
|
+
if (!!(usage.flags & 8388608 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
|
|
42585
42587
|
return true;
|
|
42586
42588
|
}
|
|
42587
42589
|
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
|
@@ -42592,9 +42594,6 @@ ${lanes.join("\n")}
|
|
|
42592
42594
|
}
|
|
42593
42595
|
}
|
|
42594
42596
|
return false;
|
|
42595
|
-
function usageInTypeDeclaration() {
|
|
42596
|
-
return !!findAncestor(usage, (node) => isInterfaceDeclaration(node) || isTypeAliasDeclaration(node));
|
|
42597
|
-
}
|
|
42598
42597
|
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration2, usage2) {
|
|
42599
42598
|
switch (declaration2.parent.parent.kind) {
|
|
42600
42599
|
case 240 /* VariableStatement */:
|
|
@@ -59301,6 +59300,9 @@ ${lanes.join("\n")}
|
|
|
59301
59300
|
(n) => n.kind === 183 /* TypeQuery */ ? true : n.kind === 79 /* Identifier */ || n.kind === 163 /* QualifiedName */ ? false : "quit"
|
|
59302
59301
|
);
|
|
59303
59302
|
}
|
|
59303
|
+
function isInAmbientOrTypeNode(node) {
|
|
59304
|
+
return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeLiteralNode(n)));
|
|
59305
|
+
}
|
|
59304
59306
|
function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
|
|
59305
59307
|
switch (node.kind) {
|
|
59306
59308
|
case 79 /* Identifier */:
|
|
@@ -60988,7 +60990,7 @@ ${lanes.join("\n")}
|
|
|
60988
60990
|
return type;
|
|
60989
60991
|
}
|
|
60990
60992
|
function narrowType(type, expr, assumeTrue) {
|
|
60991
|
-
if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && expr.parent.operatorToken.kind === 60 /* QuestionQuestionToken */ && expr.parent.left === expr) {
|
|
60993
|
+
if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && (expr.parent.operatorToken.kind === 60 /* QuestionQuestionToken */ || expr.parent.operatorToken.kind === 77 /* QuestionQuestionEqualsToken */) && expr.parent.left === expr) {
|
|
60992
60994
|
return narrowTypeByOptionality(type, expr, assumeTrue);
|
|
60993
60995
|
}
|
|
60994
60996
|
switch (expr.kind) {
|
|
@@ -61283,7 +61285,7 @@ ${lanes.join("\n")}
|
|
|
61283
61285
|
while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* FunctionExpression */ || flowContainer.kind === 216 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
|
|
61284
61286
|
flowContainer = getControlFlowContainer(flowContainer);
|
|
61285
61287
|
}
|
|
61286
|
-
const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
|
|
61288
|
+
const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
|
|
61287
61289
|
const initialType = assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : type === autoType || type === autoArrayType ? undefinedType : getOptionalType(type);
|
|
61288
61290
|
const flowType = getFlowTypeOfReference(node, type, initialType, flowContainer);
|
|
61289
61291
|
if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
|
|
@@ -73206,7 +73208,17 @@ ${lanes.join("\n")}
|
|
|
73206
73208
|
}
|
|
73207
73209
|
function checkJSDocTypeIsInJsFile(node) {
|
|
73208
73210
|
if (!isInJSFile(node)) {
|
|
73209
|
-
|
|
73211
|
+
if (isJSDocNonNullableType(node) || isJSDocNullableType(node)) {
|
|
73212
|
+
const token = tokenToString(isJSDocNonNullableType(node) ? 53 /* ExclamationToken */ : 57 /* QuestionToken */);
|
|
73213
|
+
const diagnostic = node.postfix ? Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1 : Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1;
|
|
73214
|
+
const typeNode = node.type;
|
|
73215
|
+
const type = getTypeFromTypeNode(typeNode);
|
|
73216
|
+
grammarErrorOnNode(node, diagnostic, token, typeToString(
|
|
73217
|
+
isJSDocNullableType(node) && !(type === neverType || type === voidType) ? getUnionType(append([type, undefinedType], node.postfix ? void 0 : nullType)) : type
|
|
73218
|
+
));
|
|
73219
|
+
} else {
|
|
73220
|
+
grammarErrorOnNode(node, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
|
|
73221
|
+
}
|
|
73210
73222
|
}
|
|
73211
73223
|
}
|
|
73212
73224
|
function checkJSDocVariadicType(node) {
|
|
@@ -127599,7 +127611,7 @@ ${lanes.join("\n")}
|
|
|
127599
127611
|
function getInfo11(sourceFile, pos, checker) {
|
|
127600
127612
|
const decl = findAncestor(getTokenAtPosition(sourceFile, pos), isTypeContainer);
|
|
127601
127613
|
const typeNode = decl && decl.type;
|
|
127602
|
-
return typeNode && { typeNode, type: checker
|
|
127614
|
+
return typeNode && { typeNode, type: getType(checker, typeNode) };
|
|
127603
127615
|
}
|
|
127604
127616
|
function isTypeContainer(node) {
|
|
127605
127617
|
switch (node.kind) {
|
|
@@ -127624,6 +127636,18 @@ ${lanes.join("\n")}
|
|
|
127624
127636
|
return false;
|
|
127625
127637
|
}
|
|
127626
127638
|
}
|
|
127639
|
+
function getType(checker, node) {
|
|
127640
|
+
if (isJSDocNullableType(node)) {
|
|
127641
|
+
const type = checker.getTypeFromTypeNode(node.type);
|
|
127642
|
+
if (type === checker.getNeverType() || type === checker.getVoidType()) {
|
|
127643
|
+
return type;
|
|
127644
|
+
}
|
|
127645
|
+
return checker.getUnionType(
|
|
127646
|
+
append([type, checker.getUndefinedType()], node.postfix ? void 0 : checker.getNullType())
|
|
127647
|
+
);
|
|
127648
|
+
}
|
|
127649
|
+
return checker.getTypeFromTypeNode(node);
|
|
127650
|
+
}
|
|
127627
127651
|
var fixIdPlain, fixIdNullable, errorCodes44;
|
|
127628
127652
|
var init_fixJSDocTypes = __esm({
|
|
127629
127653
|
"src/services/codefixes/fixJSDocTypes.ts"() {
|
|
@@ -127632,7 +127656,11 @@ ${lanes.join("\n")}
|
|
|
127632
127656
|
init_ts_codefix();
|
|
127633
127657
|
fixIdPlain = "fixJSDocTypes_plain";
|
|
127634
127658
|
fixIdNullable = "fixJSDocTypes_nullable";
|
|
127635
|
-
errorCodes44 = [
|
|
127659
|
+
errorCodes44 = [
|
|
127660
|
+
Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code,
|
|
127661
|
+
Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code,
|
|
127662
|
+
Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code
|
|
127663
|
+
];
|
|
127636
127664
|
registerCodeFix({
|
|
127637
127665
|
errorCodes: errorCodes44,
|
|
127638
127666
|
getCodeActions(context) {
|
|
@@ -127645,7 +127673,7 @@ ${lanes.join("\n")}
|
|
|
127645
127673
|
const original = typeNode.getText(sourceFile);
|
|
127646
127674
|
const actions2 = [fix(type, fixIdPlain, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)];
|
|
127647
127675
|
if (typeNode.kind === 317 /* JSDocNullableType */) {
|
|
127648
|
-
actions2.push(fix(
|
|
127676
|
+
actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
|
|
127649
127677
|
}
|
|
127650
127678
|
return actions2;
|
|
127651
127679
|
function fix(type2, fixId52, fixAllDescription) {
|
package/lib/typescript.js
CHANGED
|
@@ -42,7 +42,7 @@ var ts = (() => {
|
|
|
42
42
|
"src/compiler/corePublic.ts"() {
|
|
43
43
|
"use strict";
|
|
44
44
|
versionMajorMinor = "5.0";
|
|
45
|
-
version = `${versionMajorMinor}.0-dev.
|
|
45
|
+
version = `${versionMajorMinor}.0-dev.20221231`;
|
|
46
46
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
47
47
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
48
48
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -8603,6 +8603,8 @@ ${lanes.join("\n")}
|
|
|
8603
8603
|
The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option: diag(17016, 1 /* Error */, "The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_com_17016", "The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option."),
|
|
8604
8604
|
An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments: diag(17017, 1 /* Error */, "An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments_17017", "An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments."),
|
|
8605
8605
|
Unknown_type_acquisition_option_0_Did_you_mean_1: diag(17018, 1 /* Error */, "Unknown_type_acquisition_option_0_Did_you_mean_1_17018", "Unknown type acquisition option '{0}'. Did you mean '{1}'?"),
|
|
8606
|
+
_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17019, 1 /* Error */, "_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17019", "'{0}' at the end of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
|
|
8607
|
+
_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17020, 1 /* Error */, "_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17020", "'{0}' at the start of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
|
|
8606
8608
|
Circularity_detected_while_resolving_configuration_Colon_0: diag(18e3, 1 /* Error */, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"),
|
|
8607
8609
|
The_files_list_in_config_file_0_is_empty: diag(18002, 1 /* Error */, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."),
|
|
8608
8610
|
No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: diag(18003, 1 /* Error */, "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."),
|
|
@@ -42581,7 +42583,7 @@ ${lanes.join("\n")}
|
|
|
42581
42583
|
if (usage.kind === 274 /* ExportAssignment */ && usage.isExportEquals) {
|
|
42582
42584
|
return true;
|
|
42583
42585
|
}
|
|
42584
|
-
if (!!(usage.flags & 8388608 /* JSDoc */) || isInTypeQuery(usage) ||
|
|
42586
|
+
if (!!(usage.flags & 8388608 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
|
|
42585
42587
|
return true;
|
|
42586
42588
|
}
|
|
42587
42589
|
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
|
@@ -42592,9 +42594,6 @@ ${lanes.join("\n")}
|
|
|
42592
42594
|
}
|
|
42593
42595
|
}
|
|
42594
42596
|
return false;
|
|
42595
|
-
function usageInTypeDeclaration() {
|
|
42596
|
-
return !!findAncestor(usage, (node) => isInterfaceDeclaration(node) || isTypeAliasDeclaration(node));
|
|
42597
|
-
}
|
|
42598
42597
|
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration2, usage2) {
|
|
42599
42598
|
switch (declaration2.parent.parent.kind) {
|
|
42600
42599
|
case 240 /* VariableStatement */:
|
|
@@ -59301,6 +59300,9 @@ ${lanes.join("\n")}
|
|
|
59301
59300
|
(n) => n.kind === 183 /* TypeQuery */ ? true : n.kind === 79 /* Identifier */ || n.kind === 163 /* QualifiedName */ ? false : "quit"
|
|
59302
59301
|
);
|
|
59303
59302
|
}
|
|
59303
|
+
function isInAmbientOrTypeNode(node) {
|
|
59304
|
+
return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeLiteralNode(n)));
|
|
59305
|
+
}
|
|
59304
59306
|
function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
|
|
59305
59307
|
switch (node.kind) {
|
|
59306
59308
|
case 79 /* Identifier */:
|
|
@@ -60988,7 +60990,7 @@ ${lanes.join("\n")}
|
|
|
60988
60990
|
return type;
|
|
60989
60991
|
}
|
|
60990
60992
|
function narrowType(type, expr, assumeTrue) {
|
|
60991
|
-
if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && expr.parent.operatorToken.kind === 60 /* QuestionQuestionToken */ && expr.parent.left === expr) {
|
|
60993
|
+
if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && (expr.parent.operatorToken.kind === 60 /* QuestionQuestionToken */ || expr.parent.operatorToken.kind === 77 /* QuestionQuestionEqualsToken */) && expr.parent.left === expr) {
|
|
60992
60994
|
return narrowTypeByOptionality(type, expr, assumeTrue);
|
|
60993
60995
|
}
|
|
60994
60996
|
switch (expr.kind) {
|
|
@@ -61283,7 +61285,7 @@ ${lanes.join("\n")}
|
|
|
61283
61285
|
while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* FunctionExpression */ || flowContainer.kind === 216 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
|
|
61284
61286
|
flowContainer = getControlFlowContainer(flowContainer);
|
|
61285
61287
|
}
|
|
61286
|
-
const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
|
|
61288
|
+
const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
|
|
61287
61289
|
const initialType = assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : type === autoType || type === autoArrayType ? undefinedType : getOptionalType(type);
|
|
61288
61290
|
const flowType = getFlowTypeOfReference(node, type, initialType, flowContainer);
|
|
61289
61291
|
if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
|
|
@@ -73206,7 +73208,17 @@ ${lanes.join("\n")}
|
|
|
73206
73208
|
}
|
|
73207
73209
|
function checkJSDocTypeIsInJsFile(node) {
|
|
73208
73210
|
if (!isInJSFile(node)) {
|
|
73209
|
-
|
|
73211
|
+
if (isJSDocNonNullableType(node) || isJSDocNullableType(node)) {
|
|
73212
|
+
const token = tokenToString(isJSDocNonNullableType(node) ? 53 /* ExclamationToken */ : 57 /* QuestionToken */);
|
|
73213
|
+
const diagnostic = node.postfix ? Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1 : Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1;
|
|
73214
|
+
const typeNode = node.type;
|
|
73215
|
+
const type = getTypeFromTypeNode(typeNode);
|
|
73216
|
+
grammarErrorOnNode(node, diagnostic, token, typeToString(
|
|
73217
|
+
isJSDocNullableType(node) && !(type === neverType || type === voidType) ? getUnionType(append([type, undefinedType], node.postfix ? void 0 : nullType)) : type
|
|
73218
|
+
));
|
|
73219
|
+
} else {
|
|
73220
|
+
grammarErrorOnNode(node, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
|
|
73221
|
+
}
|
|
73210
73222
|
}
|
|
73211
73223
|
}
|
|
73212
73224
|
function checkJSDocVariadicType(node) {
|
|
@@ -127613,7 +127625,7 @@ ${lanes.join("\n")}
|
|
|
127613
127625
|
function getInfo11(sourceFile, pos, checker) {
|
|
127614
127626
|
const decl = findAncestor(getTokenAtPosition(sourceFile, pos), isTypeContainer);
|
|
127615
127627
|
const typeNode = decl && decl.type;
|
|
127616
|
-
return typeNode && { typeNode, type: checker
|
|
127628
|
+
return typeNode && { typeNode, type: getType(checker, typeNode) };
|
|
127617
127629
|
}
|
|
127618
127630
|
function isTypeContainer(node) {
|
|
127619
127631
|
switch (node.kind) {
|
|
@@ -127638,6 +127650,18 @@ ${lanes.join("\n")}
|
|
|
127638
127650
|
return false;
|
|
127639
127651
|
}
|
|
127640
127652
|
}
|
|
127653
|
+
function getType(checker, node) {
|
|
127654
|
+
if (isJSDocNullableType(node)) {
|
|
127655
|
+
const type = checker.getTypeFromTypeNode(node.type);
|
|
127656
|
+
if (type === checker.getNeverType() || type === checker.getVoidType()) {
|
|
127657
|
+
return type;
|
|
127658
|
+
}
|
|
127659
|
+
return checker.getUnionType(
|
|
127660
|
+
append([type, checker.getUndefinedType()], node.postfix ? void 0 : checker.getNullType())
|
|
127661
|
+
);
|
|
127662
|
+
}
|
|
127663
|
+
return checker.getTypeFromTypeNode(node);
|
|
127664
|
+
}
|
|
127641
127665
|
var fixIdPlain, fixIdNullable, errorCodes44;
|
|
127642
127666
|
var init_fixJSDocTypes = __esm({
|
|
127643
127667
|
"src/services/codefixes/fixJSDocTypes.ts"() {
|
|
@@ -127646,7 +127670,11 @@ ${lanes.join("\n")}
|
|
|
127646
127670
|
init_ts_codefix();
|
|
127647
127671
|
fixIdPlain = "fixJSDocTypes_plain";
|
|
127648
127672
|
fixIdNullable = "fixJSDocTypes_nullable";
|
|
127649
|
-
errorCodes44 = [
|
|
127673
|
+
errorCodes44 = [
|
|
127674
|
+
Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code,
|
|
127675
|
+
Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code,
|
|
127676
|
+
Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code
|
|
127677
|
+
];
|
|
127650
127678
|
registerCodeFix({
|
|
127651
127679
|
errorCodes: errorCodes44,
|
|
127652
127680
|
getCodeActions(context) {
|
|
@@ -127659,7 +127687,7 @@ ${lanes.join("\n")}
|
|
|
127659
127687
|
const original = typeNode.getText(sourceFile);
|
|
127660
127688
|
const actions2 = [fix(type, fixIdPlain, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)];
|
|
127661
127689
|
if (typeNode.kind === 317 /* JSDocNullableType */) {
|
|
127662
|
-
actions2.push(fix(
|
|
127690
|
+
actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
|
|
127663
127691
|
}
|
|
127664
127692
|
return actions2;
|
|
127665
127693
|
function fix(type2, fixId52, fixAllDescription) {
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -50,7 +50,7 @@ var path = __toESM(require("path"));
|
|
|
50
50
|
|
|
51
51
|
// src/compiler/corePublic.ts
|
|
52
52
|
var versionMajorMinor = "5.0";
|
|
53
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
53
|
+
var version = `${versionMajorMinor}.0-dev.20221231`;
|
|
54
54
|
|
|
55
55
|
// src/compiler/core.ts
|
|
56
56
|
var emptyArray = [];
|
|
@@ -6651,6 +6651,8 @@ var Diagnostics = {
|
|
|
6651
6651
|
The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option: diag(17016, 1 /* Error */, "The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_com_17016", "The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option."),
|
|
6652
6652
|
An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments: diag(17017, 1 /* Error */, "An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments_17017", "An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments."),
|
|
6653
6653
|
Unknown_type_acquisition_option_0_Did_you_mean_1: diag(17018, 1 /* Error */, "Unknown_type_acquisition_option_0_Did_you_mean_1_17018", "Unknown type acquisition option '{0}'. Did you mean '{1}'?"),
|
|
6654
|
+
_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17019, 1 /* Error */, "_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17019", "'{0}' at the end of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
|
|
6655
|
+
_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17020, 1 /* Error */, "_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17020", "'{0}' at the start of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
|
|
6654
6656
|
Circularity_detected_while_resolving_configuration_Colon_0: diag(18e3, 1 /* Error */, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"),
|
|
6655
6657
|
The_files_list_in_config_file_0_is_empty: diag(18002, 1 /* Error */, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."),
|
|
6656
6658
|
No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: diag(18003, 1 /* Error */, "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."),
|
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": "5.0.0-dev.
|
|
5
|
+
"version": "5.0.0-dev.20221231",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|