typescript 5.0.0-dev.20221229 → 5.0.0-dev.20221230

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -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.20221229`;
26
+ var version = `${versionMajorMinor}.0-dev.20221230`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -3416,6 +3416,7 @@ var NodeFlags = /* @__PURE__ */ ((NodeFlags3) => {
3416
3416
  NodeFlags3[NodeFlags3["JsonFile"] = 67108864] = "JsonFile";
3417
3417
  NodeFlags3[NodeFlags3["TypeCached"] = 134217728] = "TypeCached";
3418
3418
  NodeFlags3[NodeFlags3["Deprecated"] = 268435456] = "Deprecated";
3419
+ NodeFlags3[NodeFlags3["ConditionalTypeContext"] = 536870912] = "ConditionalTypeContext";
3419
3420
  NodeFlags3[NodeFlags3["BlockScoped"] = 3] = "BlockScoped";
3420
3421
  NodeFlags3[NodeFlags3["ReachabilityCheckFlags"] = 768] = "ReachabilityCheckFlags";
3421
3422
  NodeFlags3[NodeFlags3["ReachabilityAndEmitFlags"] = 2816] = "ReachabilityAndEmitFlags";
@@ -7208,6 +7209,8 @@ var Diagnostics = {
7208
7209
  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
7210
  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
7211
  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}'?"),
7212
+ _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}'?"),
7213
+ _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
7214
  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
7215
  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
7216
  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}'."),
@@ -58578,7 +58581,7 @@ function createTypeChecker(host) {
58578
58581
  return type;
58579
58582
  }
58580
58583
  function narrowType(type, expr, assumeTrue) {
58581
- if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && expr.parent.operatorToken.kind === 60 /* QuestionQuestionToken */ && expr.parent.left === expr) {
58584
+ if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && (expr.parent.operatorToken.kind === 60 /* QuestionQuestionToken */ || expr.parent.operatorToken.kind === 77 /* QuestionQuestionEqualsToken */) && expr.parent.left === expr) {
58582
58585
  return narrowTypeByOptionality(type, expr, assumeTrue);
58583
58586
  }
58584
58587
  switch (expr.kind) {
@@ -70796,7 +70799,17 @@ function createTypeChecker(host) {
70796
70799
  }
70797
70800
  function checkJSDocTypeIsInJsFile(node) {
70798
70801
  if (!isInJSFile(node)) {
70799
- grammarErrorOnNode(node, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
70802
+ if (isJSDocNonNullableType(node) || isJSDocNullableType(node)) {
70803
+ const token = tokenToString(isJSDocNonNullableType(node) ? 53 /* ExclamationToken */ : 57 /* QuestionToken */);
70804
+ 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;
70805
+ const typeNode = node.type;
70806
+ const type = getTypeFromTypeNode(typeNode);
70807
+ grammarErrorOnNode(node, diagnostic, token, typeToString(
70808
+ isJSDocNullableType(node) && !(type === neverType || type === voidType) ? getUnionType(append([type, undefinedType], node.postfix ? void 0 : nullType)) : type
70809
+ ));
70810
+ } else {
70811
+ grammarErrorOnNode(node, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
70812
+ }
70800
70813
  }
70801
70814
  }
70802
70815
  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.20221229`;
2673
+ var version = `${versionMajorMinor}.0-dev.20221230`;
2674
2674
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2675
2675
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2676
2676
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6576,6 +6576,7 @@ var NodeFlags = /* @__PURE__ */ ((NodeFlags4) => {
6576
6576
  NodeFlags4[NodeFlags4["JsonFile"] = 67108864] = "JsonFile";
6577
6577
  NodeFlags4[NodeFlags4["TypeCached"] = 134217728] = "TypeCached";
6578
6578
  NodeFlags4[NodeFlags4["Deprecated"] = 268435456] = "Deprecated";
6579
+ NodeFlags4[NodeFlags4["ConditionalTypeContext"] = 536870912] = "ConditionalTypeContext";
6579
6580
  NodeFlags4[NodeFlags4["BlockScoped"] = 3] = "BlockScoped";
6580
6581
  NodeFlags4[NodeFlags4["ReachabilityCheckFlags"] = 768] = "ReachabilityCheckFlags";
6581
6582
  NodeFlags4[NodeFlags4["ReachabilityAndEmitFlags"] = 2816] = "ReachabilityAndEmitFlags";
@@ -11156,6 +11157,8 @@ var Diagnostics = {
11156
11157
  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
11158
  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
11159
  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}'?"),
11160
+ _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}'?"),
11161
+ _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
11162
  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
11163
  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
11164
  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}'."),
@@ -63554,7 +63557,7 @@ function createTypeChecker(host) {
63554
63557
  return type;
63555
63558
  }
63556
63559
  function narrowType(type, expr, assumeTrue) {
63557
- if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && expr.parent.operatorToken.kind === 60 /* QuestionQuestionToken */ && expr.parent.left === expr) {
63560
+ if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && (expr.parent.operatorToken.kind === 60 /* QuestionQuestionToken */ || expr.parent.operatorToken.kind === 77 /* QuestionQuestionEqualsToken */) && expr.parent.left === expr) {
63558
63561
  return narrowTypeByOptionality(type, expr, assumeTrue);
63559
63562
  }
63560
63563
  switch (expr.kind) {
@@ -75772,7 +75775,17 @@ function createTypeChecker(host) {
75772
75775
  }
75773
75776
  function checkJSDocTypeIsInJsFile(node) {
75774
75777
  if (!isInJSFile(node)) {
75775
- grammarErrorOnNode(node, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
75778
+ if (isJSDocNonNullableType(node) || isJSDocNullableType(node)) {
75779
+ const token = tokenToString(isJSDocNonNullableType(node) ? 53 /* ExclamationToken */ : 57 /* QuestionToken */);
75780
+ 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;
75781
+ const typeNode = node.type;
75782
+ const type = getTypeFromTypeNode(typeNode);
75783
+ grammarErrorOnNode(node, diagnostic, token, typeToString(
75784
+ isJSDocNullableType(node) && !(type === neverType || type === voidType) ? getUnionType(append([type, undefinedType], node.postfix ? void 0 : nullType)) : type
75785
+ ));
75786
+ } else {
75787
+ grammarErrorOnNode(node, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
75788
+ }
75776
75789
  }
75777
75790
  }
75778
75791
  function checkJSDocVariadicType(node) {
@@ -131780,7 +131793,11 @@ function doChange19(changes, sourceFile, start2) {
131780
131793
  // src/services/codefixes/fixJSDocTypes.ts
131781
131794
  var fixIdPlain = "fixJSDocTypes_plain";
131782
131795
  var fixIdNullable = "fixJSDocTypes_nullable";
131783
- var errorCodes44 = [Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code];
131796
+ var errorCodes44 = [
131797
+ Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code,
131798
+ Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code,
131799
+ Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code
131800
+ ];
131784
131801
  registerCodeFix({
131785
131802
  errorCodes: errorCodes44,
131786
131803
  getCodeActions(context) {
@@ -131793,7 +131810,7 @@ registerCodeFix({
131793
131810
  const original = typeNode.getText(sourceFile);
131794
131811
  const actions2 = [fix(type, fixIdPlain, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)];
131795
131812
  if (typeNode.kind === 317 /* JSDocNullableType */) {
131796
- actions2.push(fix(checker.getNullableType(type, 32768 /* Undefined */), fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
131813
+ actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
131797
131814
  }
131798
131815
  return actions2;
131799
131816
  function fix(type2, fixId52, fixAllDescription) {
@@ -131821,7 +131838,7 @@ function doChange20(changes, sourceFile, oldTypeNode, newType, checker) {
131821
131838
  function getInfo11(sourceFile, pos, checker) {
131822
131839
  const decl = findAncestor(getTokenAtPosition(sourceFile, pos), isTypeContainer);
131823
131840
  const typeNode = decl && decl.type;
131824
- return typeNode && { typeNode, type: checker.getTypeFromTypeNode(typeNode) };
131841
+ return typeNode && { typeNode, type: getType(checker, typeNode) };
131825
131842
  }
131826
131843
  function isTypeContainer(node) {
131827
131844
  switch (node.kind) {
@@ -131846,6 +131863,18 @@ function isTypeContainer(node) {
131846
131863
  return false;
131847
131864
  }
131848
131865
  }
131866
+ function getType(checker, node) {
131867
+ if (isJSDocNullableType(node)) {
131868
+ const type = checker.getTypeFromTypeNode(node.type);
131869
+ if (type === checker.getNeverType() || type === checker.getVoidType()) {
131870
+ return type;
131871
+ }
131872
+ return checker.getUnionType(
131873
+ append([type, checker.getUndefinedType()], node.postfix ? void 0 : checker.getNullType())
131874
+ );
131875
+ }
131876
+ return checker.getTypeFromTypeNode(node);
131877
+ }
131849
131878
 
131850
131879
  // src/services/codefixes/fixMissingCallParentheses.ts
131851
131880
  var fixId35 = "fixMissingCallParentheses";
@@ -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.20221229`;
45
+ version = `${versionMajorMinor}.0-dev.20221230`;
46
46
  Comparison = /* @__PURE__ */ ((Comparison3) => {
47
47
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
48
48
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -4006,6 +4006,7 @@ ${lanes.join("\n")}
4006
4006
  NodeFlags4[NodeFlags4["JsonFile"] = 67108864] = "JsonFile";
4007
4007
  NodeFlags4[NodeFlags4["TypeCached"] = 134217728] = "TypeCached";
4008
4008
  NodeFlags4[NodeFlags4["Deprecated"] = 268435456] = "Deprecated";
4009
+ NodeFlags4[NodeFlags4["ConditionalTypeContext"] = 536870912] = "ConditionalTypeContext";
4009
4010
  NodeFlags4[NodeFlags4["BlockScoped"] = 3] = "BlockScoped";
4010
4011
  NodeFlags4[NodeFlags4["ReachabilityCheckFlags"] = 768] = "ReachabilityCheckFlags";
4011
4012
  NodeFlags4[NodeFlags4["ReachabilityAndEmitFlags"] = 2816] = "ReachabilityAndEmitFlags";
@@ -8603,6 +8604,8 @@ ${lanes.join("\n")}
8603
8604
  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
8605
  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
8606
  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}'?"),
8607
+ _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}'?"),
8608
+ _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
8609
  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
8610
  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
8611
  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}'."),
@@ -60988,7 +60991,7 @@ ${lanes.join("\n")}
60988
60991
  return type;
60989
60992
  }
60990
60993
  function narrowType(type, expr, assumeTrue) {
60991
- if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && expr.parent.operatorToken.kind === 60 /* QuestionQuestionToken */ && expr.parent.left === expr) {
60994
+ if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && (expr.parent.operatorToken.kind === 60 /* QuestionQuestionToken */ || expr.parent.operatorToken.kind === 77 /* QuestionQuestionEqualsToken */) && expr.parent.left === expr) {
60992
60995
  return narrowTypeByOptionality(type, expr, assumeTrue);
60993
60996
  }
60994
60997
  switch (expr.kind) {
@@ -73206,7 +73209,17 @@ ${lanes.join("\n")}
73206
73209
  }
73207
73210
  function checkJSDocTypeIsInJsFile(node) {
73208
73211
  if (!isInJSFile(node)) {
73209
- grammarErrorOnNode(node, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
73212
+ if (isJSDocNonNullableType(node) || isJSDocNullableType(node)) {
73213
+ const token = tokenToString(isJSDocNonNullableType(node) ? 53 /* ExclamationToken */ : 57 /* QuestionToken */);
73214
+ 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;
73215
+ const typeNode = node.type;
73216
+ const type = getTypeFromTypeNode(typeNode);
73217
+ grammarErrorOnNode(node, diagnostic, token, typeToString(
73218
+ isJSDocNullableType(node) && !(type === neverType || type === voidType) ? getUnionType(append([type, undefinedType], node.postfix ? void 0 : nullType)) : type
73219
+ ));
73220
+ } else {
73221
+ grammarErrorOnNode(node, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
73222
+ }
73210
73223
  }
73211
73224
  }
73212
73225
  function checkJSDocVariadicType(node) {
@@ -127599,7 +127612,7 @@ ${lanes.join("\n")}
127599
127612
  function getInfo11(sourceFile, pos, checker) {
127600
127613
  const decl = findAncestor(getTokenAtPosition(sourceFile, pos), isTypeContainer);
127601
127614
  const typeNode = decl && decl.type;
127602
- return typeNode && { typeNode, type: checker.getTypeFromTypeNode(typeNode) };
127615
+ return typeNode && { typeNode, type: getType(checker, typeNode) };
127603
127616
  }
127604
127617
  function isTypeContainer(node) {
127605
127618
  switch (node.kind) {
@@ -127624,6 +127637,18 @@ ${lanes.join("\n")}
127624
127637
  return false;
127625
127638
  }
127626
127639
  }
127640
+ function getType(checker, node) {
127641
+ if (isJSDocNullableType(node)) {
127642
+ const type = checker.getTypeFromTypeNode(node.type);
127643
+ if (type === checker.getNeverType() || type === checker.getVoidType()) {
127644
+ return type;
127645
+ }
127646
+ return checker.getUnionType(
127647
+ append([type, checker.getUndefinedType()], node.postfix ? void 0 : checker.getNullType())
127648
+ );
127649
+ }
127650
+ return checker.getTypeFromTypeNode(node);
127651
+ }
127627
127652
  var fixIdPlain, fixIdNullable, errorCodes44;
127628
127653
  var init_fixJSDocTypes = __esm({
127629
127654
  "src/services/codefixes/fixJSDocTypes.ts"() {
@@ -127632,7 +127657,11 @@ ${lanes.join("\n")}
127632
127657
  init_ts_codefix();
127633
127658
  fixIdPlain = "fixJSDocTypes_plain";
127634
127659
  fixIdNullable = "fixJSDocTypes_nullable";
127635
- errorCodes44 = [Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code];
127660
+ errorCodes44 = [
127661
+ Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code,
127662
+ Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code,
127663
+ Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code
127664
+ ];
127636
127665
  registerCodeFix({
127637
127666
  errorCodes: errorCodes44,
127638
127667
  getCodeActions(context) {
@@ -127645,7 +127674,7 @@ ${lanes.join("\n")}
127645
127674
  const original = typeNode.getText(sourceFile);
127646
127675
  const actions2 = [fix(type, fixIdPlain, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)];
127647
127676
  if (typeNode.kind === 317 /* JSDocNullableType */) {
127648
- actions2.push(fix(checker.getNullableType(type, 32768 /* Undefined */), fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
127677
+ actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
127649
127678
  }
127650
127679
  return actions2;
127651
127680
  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.20221229`;
45
+ version = `${versionMajorMinor}.0-dev.20221230`;
46
46
  Comparison = /* @__PURE__ */ ((Comparison3) => {
47
47
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
48
48
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -4006,6 +4006,7 @@ ${lanes.join("\n")}
4006
4006
  NodeFlags4[NodeFlags4["JsonFile"] = 67108864] = "JsonFile";
4007
4007
  NodeFlags4[NodeFlags4["TypeCached"] = 134217728] = "TypeCached";
4008
4008
  NodeFlags4[NodeFlags4["Deprecated"] = 268435456] = "Deprecated";
4009
+ NodeFlags4[NodeFlags4["ConditionalTypeContext"] = 536870912] = "ConditionalTypeContext";
4009
4010
  NodeFlags4[NodeFlags4["BlockScoped"] = 3] = "BlockScoped";
4010
4011
  NodeFlags4[NodeFlags4["ReachabilityCheckFlags"] = 768] = "ReachabilityCheckFlags";
4011
4012
  NodeFlags4[NodeFlags4["ReachabilityAndEmitFlags"] = 2816] = "ReachabilityAndEmitFlags";
@@ -8603,6 +8604,8 @@ ${lanes.join("\n")}
8603
8604
  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
8605
  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
8606
  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}'?"),
8607
+ _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}'?"),
8608
+ _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
8609
  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
8610
  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
8611
  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}'."),
@@ -60988,7 +60991,7 @@ ${lanes.join("\n")}
60988
60991
  return type;
60989
60992
  }
60990
60993
  function narrowType(type, expr, assumeTrue) {
60991
- if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && expr.parent.operatorToken.kind === 60 /* QuestionQuestionToken */ && expr.parent.left === expr) {
60994
+ if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && (expr.parent.operatorToken.kind === 60 /* QuestionQuestionToken */ || expr.parent.operatorToken.kind === 77 /* QuestionQuestionEqualsToken */) && expr.parent.left === expr) {
60992
60995
  return narrowTypeByOptionality(type, expr, assumeTrue);
60993
60996
  }
60994
60997
  switch (expr.kind) {
@@ -73206,7 +73209,17 @@ ${lanes.join("\n")}
73206
73209
  }
73207
73210
  function checkJSDocTypeIsInJsFile(node) {
73208
73211
  if (!isInJSFile(node)) {
73209
- grammarErrorOnNode(node, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
73212
+ if (isJSDocNonNullableType(node) || isJSDocNullableType(node)) {
73213
+ const token = tokenToString(isJSDocNonNullableType(node) ? 53 /* ExclamationToken */ : 57 /* QuestionToken */);
73214
+ 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;
73215
+ const typeNode = node.type;
73216
+ const type = getTypeFromTypeNode(typeNode);
73217
+ grammarErrorOnNode(node, diagnostic, token, typeToString(
73218
+ isJSDocNullableType(node) && !(type === neverType || type === voidType) ? getUnionType(append([type, undefinedType], node.postfix ? void 0 : nullType)) : type
73219
+ ));
73220
+ } else {
73221
+ grammarErrorOnNode(node, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
73222
+ }
73210
73223
  }
73211
73224
  }
73212
73225
  function checkJSDocVariadicType(node) {
@@ -127613,7 +127626,7 @@ ${lanes.join("\n")}
127613
127626
  function getInfo11(sourceFile, pos, checker) {
127614
127627
  const decl = findAncestor(getTokenAtPosition(sourceFile, pos), isTypeContainer);
127615
127628
  const typeNode = decl && decl.type;
127616
- return typeNode && { typeNode, type: checker.getTypeFromTypeNode(typeNode) };
127629
+ return typeNode && { typeNode, type: getType(checker, typeNode) };
127617
127630
  }
127618
127631
  function isTypeContainer(node) {
127619
127632
  switch (node.kind) {
@@ -127638,6 +127651,18 @@ ${lanes.join("\n")}
127638
127651
  return false;
127639
127652
  }
127640
127653
  }
127654
+ function getType(checker, node) {
127655
+ if (isJSDocNullableType(node)) {
127656
+ const type = checker.getTypeFromTypeNode(node.type);
127657
+ if (type === checker.getNeverType() || type === checker.getVoidType()) {
127658
+ return type;
127659
+ }
127660
+ return checker.getUnionType(
127661
+ append([type, checker.getUndefinedType()], node.postfix ? void 0 : checker.getNullType())
127662
+ );
127663
+ }
127664
+ return checker.getTypeFromTypeNode(node);
127665
+ }
127641
127666
  var fixIdPlain, fixIdNullable, errorCodes44;
127642
127667
  var init_fixJSDocTypes = __esm({
127643
127668
  "src/services/codefixes/fixJSDocTypes.ts"() {
@@ -127646,7 +127671,11 @@ ${lanes.join("\n")}
127646
127671
  init_ts_codefix();
127647
127672
  fixIdPlain = "fixJSDocTypes_plain";
127648
127673
  fixIdNullable = "fixJSDocTypes_nullable";
127649
- errorCodes44 = [Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code];
127674
+ errorCodes44 = [
127675
+ Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code,
127676
+ Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code,
127677
+ Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code
127678
+ ];
127650
127679
  registerCodeFix({
127651
127680
  errorCodes: errorCodes44,
127652
127681
  getCodeActions(context) {
@@ -127659,7 +127688,7 @@ ${lanes.join("\n")}
127659
127688
  const original = typeNode.getText(sourceFile);
127660
127689
  const actions2 = [fix(type, fixIdPlain, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)];
127661
127690
  if (typeNode.kind === 317 /* JSDocNullableType */) {
127662
- actions2.push(fix(checker.getNullableType(type, 32768 /* Undefined */), fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
127691
+ actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
127663
127692
  }
127664
127693
  return actions2;
127665
127694
  function fix(type2, fixId52, fixAllDescription) {
@@ -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.20221229`;
53
+ var version = `${versionMajorMinor}.0-dev.20221230`;
54
54
 
55
55
  // src/compiler/core.ts
56
56
  var emptyArray = [];
@@ -2929,6 +2929,7 @@ var NodeFlags = /* @__PURE__ */ ((NodeFlags3) => {
2929
2929
  NodeFlags3[NodeFlags3["JsonFile"] = 67108864] = "JsonFile";
2930
2930
  NodeFlags3[NodeFlags3["TypeCached"] = 134217728] = "TypeCached";
2931
2931
  NodeFlags3[NodeFlags3["Deprecated"] = 268435456] = "Deprecated";
2932
+ NodeFlags3[NodeFlags3["ConditionalTypeContext"] = 536870912] = "ConditionalTypeContext";
2932
2933
  NodeFlags3[NodeFlags3["BlockScoped"] = 3] = "BlockScoped";
2933
2934
  NodeFlags3[NodeFlags3["ReachabilityCheckFlags"] = 768] = "ReachabilityCheckFlags";
2934
2935
  NodeFlags3[NodeFlags3["ReachabilityAndEmitFlags"] = 2816] = "ReachabilityAndEmitFlags";
@@ -6651,6 +6652,8 @@ var Diagnostics = {
6651
6652
  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
6653
  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
6654
  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}'?"),
6655
+ _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}'?"),
6656
+ _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
6657
  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
6658
  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
6659
  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.20221229",
5
+ "version": "5.0.0-dev.20221230",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [