typescript 5.0.0-dev.20230203 → 5.0.0-dev.20230204

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.20230203`;
26
+ var version = `${versionMajorMinor}.0-dev.20230204`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -6572,7 +6572,6 @@ var Diagnostics = {
6572
6572
  Cannot_find_type_definition_file_for_0: diag(2688, 1 /* Error */, "Cannot_find_type_definition_file_for_0_2688", "Cannot find type definition file for '{0}'."),
6573
6573
  Cannot_extend_an_interface_0_Did_you_mean_implements: diag(2689, 1 /* Error */, "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", "Cannot extend an interface '{0}'. Did you mean 'implements'?"),
6574
6574
  _0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0: diag(2690, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0_2690", "'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?"),
6575
- An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: diag(2691, 1 /* Error */, "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."),
6576
6575
  _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, 1 /* Error */, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),
6577
6576
  _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."),
6578
6577
  Namespace_0_has_no_exported_member_1: diag(2694, 1 /* Error */, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."),
@@ -42500,6 +42499,7 @@ function createTypeChecker(host) {
42500
42499
  isArrayType,
42501
42500
  isTupleType,
42502
42501
  isArrayLikeType,
42502
+ isEmptyAnonymousObjectType,
42503
42503
  isTypeInvalidDueToUnionDiscriminant,
42504
42504
  getExactOptionalProperties,
42505
42505
  getAllPossiblePropertiesOfTypes,
@@ -45362,12 +45362,9 @@ function createTypeChecker(host) {
45362
45362
  if (resolutionDiagnostic) {
45363
45363
  error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
45364
45364
  } else {
45365
- const tsExtension = tryExtractTSExtension(moduleReference);
45366
45365
  const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
45367
45366
  const resolutionIsNode16OrNext = moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */;
45368
- if (tsExtension) {
45369
- errorOnTSExtensionImport(tsExtension);
45370
- } else if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
45367
+ if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
45371
45368
  error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
45372
45369
  } else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
45373
45370
  const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
@@ -45387,10 +45384,6 @@ function createTypeChecker(host) {
45387
45384
  }
45388
45385
  }
45389
45386
  return void 0;
45390
- function errorOnTSExtensionImport(tsExtension) {
45391
- const diag2 = Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
45392
- error(errorNode, diag2, tsExtension, getSuggestedImportSource(tsExtension));
45393
- }
45394
45387
  function getSuggestedImportSource(tsExtension) {
45395
45388
  const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
45396
45389
  if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
@@ -54388,7 +54381,7 @@ function createTypeChecker(host) {
54388
54381
  return links.resolvedJSDocType;
54389
54382
  }
54390
54383
  function getSubstitutionType(baseType, constraint) {
54391
- if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType) {
54384
+ if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */) {
54392
54385
  return baseType;
54393
54386
  }
54394
54387
  const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
@@ -56075,7 +56068,7 @@ function createTypeChecker(host) {
56075
56068
  }
56076
56069
  }
56077
56070
  const propType = getTypeOfSymbol(prop);
56078
- return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : propType;
56071
+ return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : accessNode && isIndexedAccessTypeNode(accessNode) && containsMissingType(propType) ? getUnionType([propType, undefinedType]) : propType;
56079
56072
  }
56080
56073
  if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
56081
56074
  const index = +propName;
@@ -77892,7 +77885,7 @@ function createTypeChecker(host) {
77892
77885
  getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
77893
77886
  }
77894
77887
  }
77895
- if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */) {
77888
+ if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
77896
77889
  const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 93 /* ExportKeyword */);
77897
77890
  if (exportModifier) {
77898
77891
  error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
package/lib/tsserver.js CHANGED
@@ -1693,6 +1693,7 @@ __export(server_exports, {
1693
1693
  isString: () => isString,
1694
1694
  isStringAKeyword: () => isStringAKeyword,
1695
1695
  isStringANonContextualKeyword: () => isStringANonContextualKeyword,
1696
+ isStringAndEmptyAnonymousObjectIntersection: () => isStringAndEmptyAnonymousObjectIntersection,
1696
1697
  isStringDoubleQuoted: () => isStringDoubleQuoted,
1697
1698
  isStringLiteral: () => isStringLiteral,
1698
1699
  isStringLiteralLike: () => isStringLiteralLike,
@@ -2285,7 +2286,7 @@ module.exports = __toCommonJS(server_exports);
2285
2286
 
2286
2287
  // src/compiler/corePublic.ts
2287
2288
  var versionMajorMinor = "5.0";
2288
- var version = `${versionMajorMinor}.0-dev.20230203`;
2289
+ var version = `${versionMajorMinor}.0-dev.20230204`;
2289
2290
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2290
2291
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2291
2292
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -10034,7 +10035,6 @@ var Diagnostics = {
10034
10035
  Cannot_find_type_definition_file_for_0: diag(2688, 1 /* Error */, "Cannot_find_type_definition_file_for_0_2688", "Cannot find type definition file for '{0}'."),
10035
10036
  Cannot_extend_an_interface_0_Did_you_mean_implements: diag(2689, 1 /* Error */, "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", "Cannot extend an interface '{0}'. Did you mean 'implements'?"),
10036
10037
  _0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0: diag(2690, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0_2690", "'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?"),
10037
- An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: diag(2691, 1 /* Error */, "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."),
10038
10038
  _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, 1 /* Error */, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),
10039
10039
  _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."),
10040
10040
  Namespace_0_has_no_exported_member_1: diag(2694, 1 /* Error */, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."),
@@ -47062,6 +47062,7 @@ function createTypeChecker(host) {
47062
47062
  isArrayType,
47063
47063
  isTupleType,
47064
47064
  isArrayLikeType,
47065
+ isEmptyAnonymousObjectType,
47065
47066
  isTypeInvalidDueToUnionDiscriminant,
47066
47067
  getExactOptionalProperties,
47067
47068
  getAllPossiblePropertiesOfTypes,
@@ -49924,12 +49925,9 @@ function createTypeChecker(host) {
49924
49925
  if (resolutionDiagnostic) {
49925
49926
  error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
49926
49927
  } else {
49927
- const tsExtension = tryExtractTSExtension(moduleReference);
49928
49928
  const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
49929
49929
  const resolutionIsNode16OrNext = moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */;
49930
- if (tsExtension) {
49931
- errorOnTSExtensionImport(tsExtension);
49932
- } else if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
49930
+ if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
49933
49931
  error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
49934
49932
  } else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
49935
49933
  const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
@@ -49949,10 +49947,6 @@ function createTypeChecker(host) {
49949
49947
  }
49950
49948
  }
49951
49949
  return void 0;
49952
- function errorOnTSExtensionImport(tsExtension) {
49953
- const diag2 = Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
49954
- error(errorNode, diag2, tsExtension, getSuggestedImportSource(tsExtension));
49955
- }
49956
49950
  function getSuggestedImportSource(tsExtension) {
49957
49951
  const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
49958
49952
  if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
@@ -58950,7 +58944,7 @@ function createTypeChecker(host) {
58950
58944
  return links.resolvedJSDocType;
58951
58945
  }
58952
58946
  function getSubstitutionType(baseType, constraint) {
58953
- if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType) {
58947
+ if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */) {
58954
58948
  return baseType;
58955
58949
  }
58956
58950
  const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
@@ -60637,7 +60631,7 @@ function createTypeChecker(host) {
60637
60631
  }
60638
60632
  }
60639
60633
  const propType = getTypeOfSymbol(prop);
60640
- return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : propType;
60634
+ return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : accessNode && isIndexedAccessTypeNode(accessNode) && containsMissingType(propType) ? getUnionType([propType, undefinedType]) : propType;
60641
60635
  }
60642
60636
  if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
60643
60637
  const index = +propName;
@@ -82454,7 +82448,7 @@ function createTypeChecker(host) {
82454
82448
  getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
82455
82449
  }
82456
82450
  }
82457
- if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */) {
82451
+ if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
82458
82452
  const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 93 /* ExportKeyword */);
82459
82453
  if (exportModifier) {
82460
82454
  error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
@@ -128095,6 +128089,13 @@ function isStringOrRegularExpressionOrTemplateLiteral(kind) {
128095
128089
  }
128096
128090
  return false;
128097
128091
  }
128092
+ function isStringAndEmptyAnonymousObjectIntersection(type) {
128093
+ if (!type.isIntersection()) {
128094
+ return false;
128095
+ }
128096
+ const { types, checker } = type;
128097
+ return types.length === 2 && types[0].flags & 4 /* String */ && checker.isEmptyAnonymousObjectType(types[1]);
128098
+ }
128098
128099
  function isPunctuation(kind) {
128099
128100
  return 18 /* FirstPunctuation */ <= kind && kind <= 78 /* LastPunctuation */;
128100
128101
  }
@@ -148263,7 +148264,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
148263
148264
  let useBraces2 = preferences.jsxAttributeCompletionStyle === "braces";
148264
148265
  const type = typeChecker.getTypeOfSymbolAtLocation(symbol, location);
148265
148266
  if (preferences.jsxAttributeCompletionStyle === "auto" && !(type.flags & 528 /* BooleanLike */) && !(type.flags & 1048576 /* Union */ && find(type.types, (type2) => !!(type2.flags & 528 /* BooleanLike */)))) {
148266
- if (type.flags & 402653316 /* StringLike */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & (402653316 /* StringLike */ | 32768 /* Undefined */)))) {
148267
+ if (type.flags & 402653316 /* StringLike */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & (402653316 /* StringLike */ | 32768 /* Undefined */) || isStringAndEmptyAnonymousObjectIntersection(type2)))) {
148267
148268
  insertText = `${escapeSnippetText(name)}=${quote(sourceFile, preferences, "$1")}`;
148268
148269
  isSnippet = true;
148269
148270
  } else {
@@ -149316,7 +149317,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
149316
149317
  break;
149317
149318
  case 291 /* JsxExpression */:
149318
149319
  case 290 /* JsxSpreadAttribute */:
149319
- if (previousToken.kind === 19 /* CloseBraceToken */ || (previousToken.kind === 79 /* Identifier */ || previousToken.parent.kind === 288 /* JsxAttribute */)) {
149320
+ if (previousToken.kind === 19 /* CloseBraceToken */ || previousToken.kind === 79 /* Identifier */ && previousToken.parent.kind === 288 /* JsxAttribute */) {
149320
149321
  isJsxIdentifierExpected = true;
149321
149322
  }
149322
149323
  break;
@@ -168582,6 +168583,7 @@ __export(ts_exports3, {
168582
168583
  isString: () => isString,
168583
168584
  isStringAKeyword: () => isStringAKeyword,
168584
168585
  isStringANonContextualKeyword: () => isStringANonContextualKeyword,
168586
+ isStringAndEmptyAnonymousObjectIntersection: () => isStringAndEmptyAnonymousObjectIntersection,
168585
168587
  isStringDoubleQuoted: () => isStringDoubleQuoted,
168586
168588
  isStringLiteral: () => isStringLiteral,
168587
168589
  isStringLiteralLike: () => isStringLiteralLike,
@@ -182525,6 +182527,7 @@ start(initializeNodeSystem(), require("os").platform());
182525
182527
  isString,
182526
182528
  isStringAKeyword,
182527
182529
  isStringANonContextualKeyword,
182530
+ isStringAndEmptyAnonymousObjectIntersection,
182528
182531
  isStringDoubleQuoted,
182529
182532
  isStringLiteral,
182530
182533
  isStringLiteralLike,
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.0";
38
- version = `${versionMajorMinor}.0-dev.20230203`;
38
+ version = `${versionMajorMinor}.0-dev.20230204`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -7859,7 +7859,6 @@ ${lanes.join("\n")}
7859
7859
  Cannot_find_type_definition_file_for_0: diag(2688, 1 /* Error */, "Cannot_find_type_definition_file_for_0_2688", "Cannot find type definition file for '{0}'."),
7860
7860
  Cannot_extend_an_interface_0_Did_you_mean_implements: diag(2689, 1 /* Error */, "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", "Cannot extend an interface '{0}'. Did you mean 'implements'?"),
7861
7861
  _0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0: diag(2690, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0_2690", "'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?"),
7862
- An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: diag(2691, 1 /* Error */, "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."),
7863
7862
  _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, 1 /* Error */, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),
7864
7863
  _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."),
7865
7864
  Namespace_0_has_no_exported_member_1: diag(2694, 1 /* Error */, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."),
@@ -44874,6 +44873,7 @@ ${lanes.join("\n")}
44874
44873
  isArrayType,
44875
44874
  isTupleType,
44876
44875
  isArrayLikeType,
44876
+ isEmptyAnonymousObjectType,
44877
44877
  isTypeInvalidDueToUnionDiscriminant,
44878
44878
  getExactOptionalProperties,
44879
44879
  getAllPossiblePropertiesOfTypes,
@@ -47736,12 +47736,9 @@ ${lanes.join("\n")}
47736
47736
  if (resolutionDiagnostic) {
47737
47737
  error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
47738
47738
  } else {
47739
- const tsExtension = tryExtractTSExtension(moduleReference);
47740
47739
  const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
47741
47740
  const resolutionIsNode16OrNext = moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */;
47742
- if (tsExtension) {
47743
- errorOnTSExtensionImport(tsExtension);
47744
- } else if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
47741
+ if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
47745
47742
  error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
47746
47743
  } else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
47747
47744
  const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
@@ -47761,10 +47758,6 @@ ${lanes.join("\n")}
47761
47758
  }
47762
47759
  }
47763
47760
  return void 0;
47764
- function errorOnTSExtensionImport(tsExtension) {
47765
- const diag2 = Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
47766
- error(errorNode, diag2, tsExtension, getSuggestedImportSource(tsExtension));
47767
- }
47768
47761
  function getSuggestedImportSource(tsExtension) {
47769
47762
  const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
47770
47763
  if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
@@ -56762,7 +56755,7 @@ ${lanes.join("\n")}
56762
56755
  return links.resolvedJSDocType;
56763
56756
  }
56764
56757
  function getSubstitutionType(baseType, constraint) {
56765
- if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType) {
56758
+ if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */) {
56766
56759
  return baseType;
56767
56760
  }
56768
56761
  const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
@@ -58449,7 +58442,7 @@ ${lanes.join("\n")}
58449
58442
  }
58450
58443
  }
58451
58444
  const propType = getTypeOfSymbol(prop);
58452
- return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : propType;
58445
+ return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : accessNode && isIndexedAccessTypeNode(accessNode) && containsMissingType(propType) ? getUnionType([propType, undefinedType]) : propType;
58453
58446
  }
58454
58447
  if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
58455
58448
  const index = +propName;
@@ -80266,7 +80259,7 @@ ${lanes.join("\n")}
80266
80259
  getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
80267
80260
  }
80268
80261
  }
80269
- if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */) {
80262
+ if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
80270
80263
  const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 93 /* ExportKeyword */);
80271
80264
  if (exportModifier) {
80272
80265
  error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
@@ -126424,6 +126417,13 @@ ${lanes.join("\n")}
126424
126417
  }
126425
126418
  return false;
126426
126419
  }
126420
+ function isStringAndEmptyAnonymousObjectIntersection(type) {
126421
+ if (!type.isIntersection()) {
126422
+ return false;
126423
+ }
126424
+ const { types, checker } = type;
126425
+ return types.length === 2 && types[0].flags & 4 /* String */ && checker.isEmptyAnonymousObjectType(types[1]);
126426
+ }
126427
126427
  function isPunctuation(kind) {
126428
126428
  return 18 /* FirstPunctuation */ <= kind && kind <= 78 /* LastPunctuation */;
126429
126429
  }
@@ -147320,7 +147320,7 @@ ${lanes.join("\n")}
147320
147320
  let useBraces2 = preferences.jsxAttributeCompletionStyle === "braces";
147321
147321
  const type = typeChecker.getTypeOfSymbolAtLocation(symbol, location);
147322
147322
  if (preferences.jsxAttributeCompletionStyle === "auto" && !(type.flags & 528 /* BooleanLike */) && !(type.flags & 1048576 /* Union */ && find(type.types, (type2) => !!(type2.flags & 528 /* BooleanLike */)))) {
147323
- if (type.flags & 402653316 /* StringLike */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & (402653316 /* StringLike */ | 32768 /* Undefined */)))) {
147323
+ if (type.flags & 402653316 /* StringLike */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & (402653316 /* StringLike */ | 32768 /* Undefined */) || isStringAndEmptyAnonymousObjectIntersection(type2)))) {
147324
147324
  insertText = `${escapeSnippetText(name)}=${quote(sourceFile, preferences, "$1")}`;
147325
147325
  isSnippet = true;
147326
147326
  } else {
@@ -148356,7 +148356,7 @@ ${lanes.join("\n")}
148356
148356
  break;
148357
148357
  case 291 /* JsxExpression */:
148358
148358
  case 290 /* JsxSpreadAttribute */:
148359
- if (previousToken.kind === 19 /* CloseBraceToken */ || (previousToken.kind === 79 /* Identifier */ || previousToken.parent.kind === 288 /* JsxAttribute */)) {
148359
+ if (previousToken.kind === 19 /* CloseBraceToken */ || previousToken.kind === 79 /* Identifier */ && previousToken.parent.kind === 288 /* JsxAttribute */) {
148360
148360
  isJsxIdentifierExpected = true;
148361
148361
  }
148362
148362
  break;
@@ -179167,6 +179167,7 @@ ${e.message}`;
179167
179167
  isString: () => isString,
179168
179168
  isStringAKeyword: () => isStringAKeyword,
179169
179169
  isStringANonContextualKeyword: () => isStringANonContextualKeyword,
179170
+ isStringAndEmptyAnonymousObjectIntersection: () => isStringAndEmptyAnonymousObjectIntersection,
179170
179171
  isStringDoubleQuoted: () => isStringDoubleQuoted,
179171
179172
  isStringLiteral: () => isStringLiteral,
179172
179173
  isStringLiteralLike: () => isStringLiteralLike,
@@ -181524,6 +181525,7 @@ ${e.message}`;
181524
181525
  isString: () => isString,
181525
181526
  isStringAKeyword: () => isStringAKeyword,
181526
181527
  isStringANonContextualKeyword: () => isStringANonContextualKeyword,
181528
+ isStringAndEmptyAnonymousObjectIntersection: () => isStringAndEmptyAnonymousObjectIntersection,
181527
181529
  isStringDoubleQuoted: () => isStringDoubleQuoted,
181528
181530
  isStringLiteral: () => isStringLiteral,
181529
181531
  isStringLiteralLike: () => isStringLiteralLike,
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.0";
38
- version = `${versionMajorMinor}.0-dev.20230203`;
38
+ version = `${versionMajorMinor}.0-dev.20230204`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -7859,7 +7859,6 @@ ${lanes.join("\n")}
7859
7859
  Cannot_find_type_definition_file_for_0: diag(2688, 1 /* Error */, "Cannot_find_type_definition_file_for_0_2688", "Cannot find type definition file for '{0}'."),
7860
7860
  Cannot_extend_an_interface_0_Did_you_mean_implements: diag(2689, 1 /* Error */, "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", "Cannot extend an interface '{0}'. Did you mean 'implements'?"),
7861
7861
  _0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0: diag(2690, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0_2690", "'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?"),
7862
- An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: diag(2691, 1 /* Error */, "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."),
7863
7862
  _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, 1 /* Error */, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),
7864
7863
  _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."),
7865
7864
  Namespace_0_has_no_exported_member_1: diag(2694, 1 /* Error */, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."),
@@ -44874,6 +44873,7 @@ ${lanes.join("\n")}
44874
44873
  isArrayType,
44875
44874
  isTupleType,
44876
44875
  isArrayLikeType,
44876
+ isEmptyAnonymousObjectType,
44877
44877
  isTypeInvalidDueToUnionDiscriminant,
44878
44878
  getExactOptionalProperties,
44879
44879
  getAllPossiblePropertiesOfTypes,
@@ -47736,12 +47736,9 @@ ${lanes.join("\n")}
47736
47736
  if (resolutionDiagnostic) {
47737
47737
  error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
47738
47738
  } else {
47739
- const tsExtension = tryExtractTSExtension(moduleReference);
47740
47739
  const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
47741
47740
  const resolutionIsNode16OrNext = moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */;
47742
- if (tsExtension) {
47743
- errorOnTSExtensionImport(tsExtension);
47744
- } else if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
47741
+ if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
47745
47742
  error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
47746
47743
  } else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
47747
47744
  const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
@@ -47761,10 +47758,6 @@ ${lanes.join("\n")}
47761
47758
  }
47762
47759
  }
47763
47760
  return void 0;
47764
- function errorOnTSExtensionImport(tsExtension) {
47765
- const diag2 = Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
47766
- error(errorNode, diag2, tsExtension, getSuggestedImportSource(tsExtension));
47767
- }
47768
47761
  function getSuggestedImportSource(tsExtension) {
47769
47762
  const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
47770
47763
  if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
@@ -56762,7 +56755,7 @@ ${lanes.join("\n")}
56762
56755
  return links.resolvedJSDocType;
56763
56756
  }
56764
56757
  function getSubstitutionType(baseType, constraint) {
56765
- if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType) {
56758
+ if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */) {
56766
56759
  return baseType;
56767
56760
  }
56768
56761
  const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
@@ -58449,7 +58442,7 @@ ${lanes.join("\n")}
58449
58442
  }
58450
58443
  }
58451
58444
  const propType = getTypeOfSymbol(prop);
58452
- return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : propType;
58445
+ return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : accessNode && isIndexedAccessTypeNode(accessNode) && containsMissingType(propType) ? getUnionType([propType, undefinedType]) : propType;
58453
58446
  }
58454
58447
  if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
58455
58448
  const index = +propName;
@@ -80266,7 +80259,7 @@ ${lanes.join("\n")}
80266
80259
  getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
80267
80260
  }
80268
80261
  }
80269
- if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */) {
80262
+ if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
80270
80263
  const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 93 /* ExportKeyword */);
80271
80264
  if (exportModifier) {
80272
80265
  error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
@@ -126438,6 +126431,13 @@ ${lanes.join("\n")}
126438
126431
  }
126439
126432
  return false;
126440
126433
  }
126434
+ function isStringAndEmptyAnonymousObjectIntersection(type) {
126435
+ if (!type.isIntersection()) {
126436
+ return false;
126437
+ }
126438
+ const { types, checker } = type;
126439
+ return types.length === 2 && types[0].flags & 4 /* String */ && checker.isEmptyAnonymousObjectType(types[1]);
126440
+ }
126441
126441
  function isPunctuation(kind) {
126442
126442
  return 18 /* FirstPunctuation */ <= kind && kind <= 78 /* LastPunctuation */;
126443
126443
  }
@@ -147334,7 +147334,7 @@ ${lanes.join("\n")}
147334
147334
  let useBraces2 = preferences.jsxAttributeCompletionStyle === "braces";
147335
147335
  const type = typeChecker.getTypeOfSymbolAtLocation(symbol, location);
147336
147336
  if (preferences.jsxAttributeCompletionStyle === "auto" && !(type.flags & 528 /* BooleanLike */) && !(type.flags & 1048576 /* Union */ && find(type.types, (type2) => !!(type2.flags & 528 /* BooleanLike */)))) {
147337
- if (type.flags & 402653316 /* StringLike */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & (402653316 /* StringLike */ | 32768 /* Undefined */)))) {
147337
+ if (type.flags & 402653316 /* StringLike */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & (402653316 /* StringLike */ | 32768 /* Undefined */) || isStringAndEmptyAnonymousObjectIntersection(type2)))) {
147338
147338
  insertText = `${escapeSnippetText(name)}=${quote(sourceFile, preferences, "$1")}`;
147339
147339
  isSnippet = true;
147340
147340
  } else {
@@ -148370,7 +148370,7 @@ ${lanes.join("\n")}
148370
148370
  break;
148371
148371
  case 291 /* JsxExpression */:
148372
148372
  case 290 /* JsxSpreadAttribute */:
148373
- if (previousToken.kind === 19 /* CloseBraceToken */ || (previousToken.kind === 79 /* Identifier */ || previousToken.parent.kind === 288 /* JsxAttribute */)) {
148373
+ if (previousToken.kind === 19 /* CloseBraceToken */ || previousToken.kind === 79 /* Identifier */ && previousToken.parent.kind === 288 /* JsxAttribute */) {
148374
148374
  isJsxIdentifierExpected = true;
148375
148375
  }
148376
148376
  break;
@@ -168352,6 +168352,7 @@ ${options.prefix}` : "\n" : options.prefix
168352
168352
  isString: () => isString,
168353
168353
  isStringAKeyword: () => isStringAKeyword,
168354
168354
  isStringANonContextualKeyword: () => isStringANonContextualKeyword,
168355
+ isStringAndEmptyAnonymousObjectIntersection: () => isStringAndEmptyAnonymousObjectIntersection,
168355
168356
  isStringDoubleQuoted: () => isStringDoubleQuoted,
168356
168357
  isStringLiteral: () => isStringLiteral,
168357
168358
  isStringLiteralLike: () => isStringLiteralLike,
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.0";
57
- var version = `${versionMajorMinor}.0-dev.20230203`;
57
+ var version = `${versionMajorMinor}.0-dev.20230204`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -5980,7 +5980,6 @@ var Diagnostics = {
5980
5980
  Cannot_find_type_definition_file_for_0: diag(2688, 1 /* Error */, "Cannot_find_type_definition_file_for_0_2688", "Cannot find type definition file for '{0}'."),
5981
5981
  Cannot_extend_an_interface_0_Did_you_mean_implements: diag(2689, 1 /* Error */, "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", "Cannot extend an interface '{0}'. Did you mean 'implements'?"),
5982
5982
  _0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0: diag(2690, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0_2690", "'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?"),
5983
- An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: diag(2691, 1 /* Error */, "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."),
5984
5983
  _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, 1 /* Error */, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),
5985
5984
  _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."),
5986
5985
  Namespace_0_has_no_exported_member_1: diag(2694, 1 /* Error */, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."),
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.20230203",
5
+ "version": "5.0.0-dev.20230204",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [