typescript 5.1.0-dev.20230405 → 5.1.0-dev.20230407
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 +25 -17
- package/lib/tsserver.js +28 -17
- package/lib/tsserverlibrary.js +28 -18
- package/lib/typescript.js +27 -18
- package/lib/typingsInstaller.js +11 -4
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.1";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20230407`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -16595,6 +16595,7 @@ var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts
|
|
|
16595
16595
|
var allSupportedExtensionsWithJson = [...allSupportedExtensions, [".json" /* Json */]];
|
|
16596
16596
|
var supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */];
|
|
16597
16597
|
var supportedTSImplementationExtensions = [".ts" /* Ts */, ".cts" /* Cts */, ".mts" /* Mts */, ".tsx" /* Tsx */];
|
|
16598
|
+
var extensionsNotSupportingExtensionlessResolution = [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */];
|
|
16598
16599
|
function getSupportedExtensions(options, extraFileExtensions) {
|
|
16599
16600
|
const needJsExtensions = options && getAllowJSCompilerOption(options);
|
|
16600
16601
|
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
|
@@ -16627,7 +16628,7 @@ function hasTSFileExtension(fileName) {
|
|
|
16627
16628
|
return some(supportedTSExtensionsFlat, (extension) => fileExtensionIs(fileName, extension));
|
|
16628
16629
|
}
|
|
16629
16630
|
function usesExtensionsOnImports({ imports }, hasExtension2 = or(hasJSFileExtension, hasTSFileExtension)) {
|
|
16630
|
-
return firstDefined(imports, ({ text }) => pathIsRelative(text) ? hasExtension2(text) : void 0) || false;
|
|
16631
|
+
return firstDefined(imports, ({ text }) => pathIsRelative(text) && !fileExtensionIsOneOf(text, extensionsNotSupportingExtensionlessResolution) ? hasExtension2(text) : void 0) || false;
|
|
16631
16632
|
}
|
|
16632
16633
|
function getModuleSpecifierEndingPreference(preference, resolutionMode, compilerOptions, sourceFile) {
|
|
16633
16634
|
if (preference === "js" || resolutionMode === 99 /* ESNext */) {
|
|
@@ -16651,6 +16652,9 @@ function getModuleSpecifierEndingPreference(preference, resolutionMode, compiler
|
|
|
16651
16652
|
const specifiers = sourceFile.imports.length ? sourceFile.imports.map((i) => i.text) : isSourceFileJS(sourceFile) ? getRequiresAtTopOfFile(sourceFile).map((r) => r.arguments[0].text) : emptyArray;
|
|
16652
16653
|
for (const specifier of specifiers) {
|
|
16653
16654
|
if (pathIsRelative(specifier)) {
|
|
16655
|
+
if (fileExtensionIsOneOf(specifier, extensionsNotSupportingExtensionlessResolution)) {
|
|
16656
|
+
continue;
|
|
16657
|
+
}
|
|
16654
16658
|
if (hasTSFileExtension(specifier)) {
|
|
16655
16659
|
return 3 /* TsExtension */;
|
|
16656
16660
|
}
|
|
@@ -29277,6 +29281,12 @@ var Parser;
|
|
|
29277
29281
|
if (languageVariant === 1 /* JSX */) {
|
|
29278
29282
|
return parseJsxElementOrSelfClosingElementOrFragment(
|
|
29279
29283
|
/*inExpressionContext*/
|
|
29284
|
+
true,
|
|
29285
|
+
/*topInvalidNodePosition*/
|
|
29286
|
+
void 0,
|
|
29287
|
+
/*openingTag*/
|
|
29288
|
+
void 0,
|
|
29289
|
+
/*mustBeUnary*/
|
|
29280
29290
|
true
|
|
29281
29291
|
);
|
|
29282
29292
|
}
|
|
@@ -29381,7 +29391,7 @@ var Parser;
|
|
|
29381
29391
|
true
|
|
29382
29392
|
)), pos);
|
|
29383
29393
|
}
|
|
29384
|
-
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag) {
|
|
29394
|
+
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag, mustBeUnary = false) {
|
|
29385
29395
|
const pos = getNodePos();
|
|
29386
29396
|
const opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
|
|
29387
29397
|
let result;
|
|
@@ -29419,7 +29429,7 @@ var Parser;
|
|
|
29419
29429
|
Debug.assert(opening.kind === 283 /* JsxSelfClosingElement */);
|
|
29420
29430
|
result = opening;
|
|
29421
29431
|
}
|
|
29422
|
-
if (inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
29432
|
+
if (!mustBeUnary && inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
29423
29433
|
const topBadPos = typeof topInvalidNodePosition === "undefined" ? result.pos : topInvalidNodePosition;
|
|
29424
29434
|
const invalidElement = tryParse(() => parseJsxElementOrSelfClosingElementOrFragment(
|
|
29425
29435
|
/*inExpressionContext*/
|
|
@@ -29452,7 +29462,7 @@ var Parser;
|
|
|
29452
29462
|
parseErrorAtRange(openingTag, Diagnostics.JSX_fragment_has_no_corresponding_closing_tag);
|
|
29453
29463
|
} else {
|
|
29454
29464
|
const tag = openingTag.tagName;
|
|
29455
|
-
const start = skipTrivia(sourceText, tag.pos);
|
|
29465
|
+
const start = Math.min(skipTrivia(sourceText, tag.pos), tag.end);
|
|
29456
29466
|
parseErrorAt(start, tag.end, Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, getTextOfNodeFromSourceText(sourceText, openingTag.tagName));
|
|
29457
29467
|
}
|
|
29458
29468
|
return void 0;
|
|
@@ -41714,7 +41724,7 @@ function getPreferences({ importModuleSpecifierPreference, importModuleSpecifier
|
|
|
41714
41724
|
return [2 /* JsExtension */];
|
|
41715
41725
|
}
|
|
41716
41726
|
if (getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */) {
|
|
41717
|
-
return [1 /* Index */, 2 /* JsExtension */];
|
|
41727
|
+
return preferredEnding === 2 /* JsExtension */ ? [2 /* JsExtension */, 1 /* Index */] : [1 /* Index */, 2 /* JsExtension */];
|
|
41718
41728
|
}
|
|
41719
41729
|
switch (preferredEnding) {
|
|
41720
41730
|
case 2 /* JsExtension */:
|
|
@@ -72635,7 +72645,7 @@ function createTypeChecker(host) {
|
|
|
72635
72645
|
}
|
|
72636
72646
|
return getUnaryResultType(operandType);
|
|
72637
72647
|
case 53 /* ExclamationToken */:
|
|
72638
|
-
|
|
72648
|
+
checkTruthinessOfType(operandType, node.operand);
|
|
72639
72649
|
const facts = getTypeFacts(operandType) & (4194304 /* Truthy */ | 8388608 /* Falsy */);
|
|
72640
72650
|
return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
|
|
72641
72651
|
case 45 /* PlusPlusToken */:
|
|
@@ -89546,11 +89556,12 @@ function transformClassFields(context) {
|
|
|
89546
89556
|
return visitEachChild(node, visitor, context);
|
|
89547
89557
|
}
|
|
89548
89558
|
function visitArrayAssignmentElement(node) {
|
|
89549
|
-
|
|
89550
|
-
|
|
89551
|
-
|
|
89552
|
-
|
|
89553
|
-
|
|
89559
|
+
if (isArrayBindingOrAssignmentElement(node)) {
|
|
89560
|
+
if (isSpreadElement(node))
|
|
89561
|
+
return visitAssignmentRestElement(node);
|
|
89562
|
+
if (!isOmittedExpression(node))
|
|
89563
|
+
return visitAssignmentElement(node);
|
|
89564
|
+
}
|
|
89554
89565
|
return visitEachChild(node, visitor, context);
|
|
89555
89566
|
}
|
|
89556
89567
|
function visitAssignmentProperty(node) {
|
|
@@ -115618,9 +115629,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115618
115629
|
if (moduleKind === 2 /* AMD */ || moduleKind === 3 /* UMD */ || moduleKind === 4 /* System */) {
|
|
115619
115630
|
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
|
|
115620
115631
|
}
|
|
115621
|
-
if (options.isolatedModules) {
|
|
115622
|
-
createRedundantOptionDiagnostic("isolatedModules", "verbatimModuleSyntax");
|
|
115623
|
-
}
|
|
115624
115632
|
if (options.preserveValueImports) {
|
|
115625
115633
|
createRedundantOptionDiagnostic("preserveValueImports", "verbatimModuleSyntax");
|
|
115626
115634
|
}
|
|
@@ -118130,7 +118138,7 @@ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLoo
|
|
|
118130
118138
|
return {
|
|
118131
118139
|
dir: rootDir,
|
|
118132
118140
|
dirPath: rootPath,
|
|
118133
|
-
nonRecursive:
|
|
118141
|
+
nonRecursive: true
|
|
118134
118142
|
};
|
|
118135
118143
|
}
|
|
118136
118144
|
}
|
|
@@ -118578,7 +118586,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118578
118586
|
customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
|
|
118579
118587
|
}
|
|
118580
118588
|
if (dirPath === rootPath) {
|
|
118581
|
-
Debug.assert(
|
|
118589
|
+
Debug.assert(nonRecursive);
|
|
118582
118590
|
setAtRoot = true;
|
|
118583
118591
|
} else {
|
|
118584
118592
|
setDirectoryWatcher(dir, dirPath, nonRecursive);
|
package/lib/tsserver.js
CHANGED
|
@@ -546,6 +546,7 @@ __export(server_exports, {
|
|
|
546
546
|
extendsHelper: () => extendsHelper,
|
|
547
547
|
extensionFromPath: () => extensionFromPath,
|
|
548
548
|
extensionIsTS: () => extensionIsTS,
|
|
549
|
+
extensionsNotSupportingExtensionlessResolution: () => extensionsNotSupportingExtensionlessResolution,
|
|
549
550
|
externalHelpersModuleNameText: () => externalHelpersModuleNameText,
|
|
550
551
|
factory: () => factory,
|
|
551
552
|
fileExtensionIs: () => fileExtensionIs,
|
|
@@ -2292,7 +2293,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2292
2293
|
|
|
2293
2294
|
// src/compiler/corePublic.ts
|
|
2294
2295
|
var versionMajorMinor = "5.1";
|
|
2295
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2296
|
+
var version = `${versionMajorMinor}.0-dev.20230407`;
|
|
2296
2297
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2297
2298
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2298
2299
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -20739,6 +20740,7 @@ var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts
|
|
|
20739
20740
|
var allSupportedExtensionsWithJson = [...allSupportedExtensions, [".json" /* Json */]];
|
|
20740
20741
|
var supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */];
|
|
20741
20742
|
var supportedTSImplementationExtensions = [".ts" /* Ts */, ".cts" /* Cts */, ".mts" /* Mts */, ".tsx" /* Tsx */];
|
|
20743
|
+
var extensionsNotSupportingExtensionlessResolution = [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */];
|
|
20742
20744
|
function getSupportedExtensions(options, extraFileExtensions) {
|
|
20743
20745
|
const needJsExtensions = options && getAllowJSCompilerOption(options);
|
|
20744
20746
|
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
|
@@ -20778,7 +20780,7 @@ var ModuleSpecifierEnding = /* @__PURE__ */ ((ModuleSpecifierEnding2) => {
|
|
|
20778
20780
|
return ModuleSpecifierEnding2;
|
|
20779
20781
|
})(ModuleSpecifierEnding || {});
|
|
20780
20782
|
function usesExtensionsOnImports({ imports }, hasExtension2 = or(hasJSFileExtension, hasTSFileExtension)) {
|
|
20781
|
-
return firstDefined(imports, ({ text }) => pathIsRelative(text) ? hasExtension2(text) : void 0) || false;
|
|
20783
|
+
return firstDefined(imports, ({ text }) => pathIsRelative(text) && !fileExtensionIsOneOf(text, extensionsNotSupportingExtensionlessResolution) ? hasExtension2(text) : void 0) || false;
|
|
20782
20784
|
}
|
|
20783
20785
|
function getModuleSpecifierEndingPreference(preference, resolutionMode, compilerOptions, sourceFile) {
|
|
20784
20786
|
if (preference === "js" || resolutionMode === 99 /* ESNext */) {
|
|
@@ -20802,6 +20804,9 @@ function getModuleSpecifierEndingPreference(preference, resolutionMode, compiler
|
|
|
20802
20804
|
const specifiers = sourceFile.imports.length ? sourceFile.imports.map((i) => i.text) : isSourceFileJS(sourceFile) ? getRequiresAtTopOfFile(sourceFile).map((r) => r.arguments[0].text) : emptyArray;
|
|
20803
20805
|
for (const specifier of specifiers) {
|
|
20804
20806
|
if (pathIsRelative(specifier)) {
|
|
20807
|
+
if (fileExtensionIsOneOf(specifier, extensionsNotSupportingExtensionlessResolution)) {
|
|
20808
|
+
continue;
|
|
20809
|
+
}
|
|
20805
20810
|
if (hasTSFileExtension(specifier)) {
|
|
20806
20811
|
return 3 /* TsExtension */;
|
|
20807
20812
|
}
|
|
@@ -33659,6 +33664,12 @@ var Parser;
|
|
|
33659
33664
|
if (languageVariant === 1 /* JSX */) {
|
|
33660
33665
|
return parseJsxElementOrSelfClosingElementOrFragment(
|
|
33661
33666
|
/*inExpressionContext*/
|
|
33667
|
+
true,
|
|
33668
|
+
/*topInvalidNodePosition*/
|
|
33669
|
+
void 0,
|
|
33670
|
+
/*openingTag*/
|
|
33671
|
+
void 0,
|
|
33672
|
+
/*mustBeUnary*/
|
|
33662
33673
|
true
|
|
33663
33674
|
);
|
|
33664
33675
|
}
|
|
@@ -33763,7 +33774,7 @@ var Parser;
|
|
|
33763
33774
|
true
|
|
33764
33775
|
)), pos);
|
|
33765
33776
|
}
|
|
33766
|
-
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag) {
|
|
33777
|
+
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag, mustBeUnary = false) {
|
|
33767
33778
|
const pos = getNodePos();
|
|
33768
33779
|
const opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
|
|
33769
33780
|
let result;
|
|
@@ -33801,7 +33812,7 @@ var Parser;
|
|
|
33801
33812
|
Debug.assert(opening.kind === 283 /* JsxSelfClosingElement */);
|
|
33802
33813
|
result = opening;
|
|
33803
33814
|
}
|
|
33804
|
-
if (inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
33815
|
+
if (!mustBeUnary && inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
33805
33816
|
const topBadPos = typeof topInvalidNodePosition === "undefined" ? result.pos : topInvalidNodePosition;
|
|
33806
33817
|
const invalidElement = tryParse(() => parseJsxElementOrSelfClosingElementOrFragment(
|
|
33807
33818
|
/*inExpressionContext*/
|
|
@@ -33834,7 +33845,7 @@ var Parser;
|
|
|
33834
33845
|
parseErrorAtRange(openingTag, Diagnostics.JSX_fragment_has_no_corresponding_closing_tag);
|
|
33835
33846
|
} else {
|
|
33836
33847
|
const tag = openingTag.tagName;
|
|
33837
|
-
const start2 = skipTrivia(sourceText, tag.pos);
|
|
33848
|
+
const start2 = Math.min(skipTrivia(sourceText, tag.pos), tag.end);
|
|
33838
33849
|
parseErrorAt(start2, tag.end, Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, getTextOfNodeFromSourceText(sourceText, openingTag.tagName));
|
|
33839
33850
|
}
|
|
33840
33851
|
return void 0;
|
|
@@ -46329,7 +46340,7 @@ function getPreferences({ importModuleSpecifierPreference, importModuleSpecifier
|
|
|
46329
46340
|
return [2 /* JsExtension */];
|
|
46330
46341
|
}
|
|
46331
46342
|
if (getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */) {
|
|
46332
|
-
return [1 /* Index */, 2 /* JsExtension */];
|
|
46343
|
+
return preferredEnding === 2 /* JsExtension */ ? [2 /* JsExtension */, 1 /* Index */] : [1 /* Index */, 2 /* JsExtension */];
|
|
46333
46344
|
}
|
|
46334
46345
|
switch (preferredEnding) {
|
|
46335
46346
|
case 2 /* JsExtension */:
|
|
@@ -77283,7 +77294,7 @@ function createTypeChecker(host) {
|
|
|
77283
77294
|
}
|
|
77284
77295
|
return getUnaryResultType(operandType);
|
|
77285
77296
|
case 53 /* ExclamationToken */:
|
|
77286
|
-
|
|
77297
|
+
checkTruthinessOfType(operandType, node.operand);
|
|
77287
77298
|
const facts = getTypeFacts(operandType) & (4194304 /* Truthy */ | 8388608 /* Falsy */);
|
|
77288
77299
|
return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
|
|
77289
77300
|
case 45 /* PlusPlusToken */:
|
|
@@ -94365,11 +94376,12 @@ function transformClassFields(context) {
|
|
|
94365
94376
|
return visitEachChild(node, visitor, context);
|
|
94366
94377
|
}
|
|
94367
94378
|
function visitArrayAssignmentElement(node) {
|
|
94368
|
-
|
|
94369
|
-
|
|
94370
|
-
|
|
94371
|
-
|
|
94372
|
-
|
|
94379
|
+
if (isArrayBindingOrAssignmentElement(node)) {
|
|
94380
|
+
if (isSpreadElement(node))
|
|
94381
|
+
return visitAssignmentRestElement(node);
|
|
94382
|
+
if (!isOmittedExpression(node))
|
|
94383
|
+
return visitAssignmentElement(node);
|
|
94384
|
+
}
|
|
94373
94385
|
return visitEachChild(node, visitor, context);
|
|
94374
94386
|
}
|
|
94375
94387
|
function visitAssignmentProperty(node) {
|
|
@@ -120502,9 +120514,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120502
120514
|
if (moduleKind === 2 /* AMD */ || moduleKind === 3 /* UMD */ || moduleKind === 4 /* System */) {
|
|
120503
120515
|
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
|
|
120504
120516
|
}
|
|
120505
|
-
if (options.isolatedModules) {
|
|
120506
|
-
createRedundantOptionDiagnostic("isolatedModules", "verbatimModuleSyntax");
|
|
120507
|
-
}
|
|
120508
120517
|
if (options.preserveValueImports) {
|
|
120509
120518
|
createRedundantOptionDiagnostic("preserveValueImports", "verbatimModuleSyntax");
|
|
120510
120519
|
}
|
|
@@ -123046,7 +123055,7 @@ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLoo
|
|
|
123046
123055
|
return {
|
|
123047
123056
|
dir: rootDir,
|
|
123048
123057
|
dirPath: rootPath,
|
|
123049
|
-
nonRecursive:
|
|
123058
|
+
nonRecursive: true
|
|
123050
123059
|
};
|
|
123051
123060
|
}
|
|
123052
123061
|
}
|
|
@@ -123494,7 +123503,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123494
123503
|
customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
|
|
123495
123504
|
}
|
|
123496
123505
|
if (dirPath === rootPath) {
|
|
123497
|
-
Debug.assert(
|
|
123506
|
+
Debug.assert(nonRecursive);
|
|
123498
123507
|
setAtRoot = true;
|
|
123499
123508
|
} else {
|
|
123500
123509
|
setDirectoryWatcher(dir, dirPath, nonRecursive);
|
|
@@ -169152,6 +169161,7 @@ __export(ts_exports2, {
|
|
|
169152
169161
|
extendsHelper: () => extendsHelper,
|
|
169153
169162
|
extensionFromPath: () => extensionFromPath,
|
|
169154
169163
|
extensionIsTS: () => extensionIsTS,
|
|
169164
|
+
extensionsNotSupportingExtensionlessResolution: () => extensionsNotSupportingExtensionlessResolution,
|
|
169155
169165
|
externalHelpersModuleNameText: () => externalHelpersModuleNameText,
|
|
169156
169166
|
factory: () => factory,
|
|
169157
169167
|
fileExtensionIs: () => fileExtensionIs,
|
|
@@ -183124,6 +183134,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
183124
183134
|
extendsHelper,
|
|
183125
183135
|
extensionFromPath,
|
|
183126
183136
|
extensionIsTS,
|
|
183137
|
+
extensionsNotSupportingExtensionlessResolution,
|
|
183127
183138
|
externalHelpersModuleNameText,
|
|
183128
183139
|
factory,
|
|
183129
183140
|
fileExtensionIs,
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230407`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -18444,7 +18444,7 @@ ${lanes.join("\n")}
|
|
|
18444
18444
|
return some(supportedTSExtensionsFlat, (extension) => fileExtensionIs(fileName, extension));
|
|
18445
18445
|
}
|
|
18446
18446
|
function usesExtensionsOnImports({ imports }, hasExtension2 = or(hasJSFileExtension, hasTSFileExtension)) {
|
|
18447
|
-
return firstDefined(imports, ({ text }) => pathIsRelative(text) ? hasExtension2(text) : void 0) || false;
|
|
18447
|
+
return firstDefined(imports, ({ text }) => pathIsRelative(text) && !fileExtensionIsOneOf(text, extensionsNotSupportingExtensionlessResolution) ? hasExtension2(text) : void 0) || false;
|
|
18448
18448
|
}
|
|
18449
18449
|
function getModuleSpecifierEndingPreference(preference, resolutionMode, compilerOptions, sourceFile) {
|
|
18450
18450
|
if (preference === "js" || resolutionMode === 99 /* ESNext */) {
|
|
@@ -18468,6 +18468,9 @@ ${lanes.join("\n")}
|
|
|
18468
18468
|
const specifiers = sourceFile.imports.length ? sourceFile.imports.map((i) => i.text) : isSourceFileJS(sourceFile) ? getRequiresAtTopOfFile(sourceFile).map((r) => r.arguments[0].text) : emptyArray;
|
|
18469
18469
|
for (const specifier of specifiers) {
|
|
18470
18470
|
if (pathIsRelative(specifier)) {
|
|
18471
|
+
if (fileExtensionIsOneOf(specifier, extensionsNotSupportingExtensionlessResolution)) {
|
|
18472
|
+
continue;
|
|
18473
|
+
}
|
|
18471
18474
|
if (hasTSFileExtension(specifier)) {
|
|
18472
18475
|
return 3 /* TsExtension */;
|
|
18473
18476
|
}
|
|
@@ -19098,7 +19101,7 @@ ${lanes.join("\n")}
|
|
|
19098
19101
|
const tag = getJSDocSatisfiesTag(node);
|
|
19099
19102
|
return tag && tag.typeExpression && tag.typeExpression.type;
|
|
19100
19103
|
}
|
|
19101
|
-
var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashAMDReferencePathRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, objectAllocator, objectAllocatorPatchers, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries;
|
|
19104
|
+
var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashAMDReferencePathRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, objectAllocator, objectAllocatorPatchers, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, extensionsNotSupportingExtensionlessResolution, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries;
|
|
19102
19105
|
var init_utilities = __esm({
|
|
19103
19106
|
"src/compiler/utilities.ts"() {
|
|
19104
19107
|
"use strict";
|
|
@@ -19262,6 +19265,7 @@ ${lanes.join("\n")}
|
|
|
19262
19265
|
allSupportedExtensionsWithJson = [...allSupportedExtensions, [".json" /* Json */]];
|
|
19263
19266
|
supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */];
|
|
19264
19267
|
supportedTSImplementationExtensions = [".ts" /* Ts */, ".cts" /* Cts */, ".mts" /* Mts */, ".tsx" /* Tsx */];
|
|
19268
|
+
extensionsNotSupportingExtensionlessResolution = [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */];
|
|
19265
19269
|
ModuleSpecifierEnding = /* @__PURE__ */ ((ModuleSpecifierEnding2) => {
|
|
19266
19270
|
ModuleSpecifierEnding2[ModuleSpecifierEnding2["Minimal"] = 0] = "Minimal";
|
|
19267
19271
|
ModuleSpecifierEnding2[ModuleSpecifierEnding2["Index"] = 1] = "Index";
|
|
@@ -31763,6 +31767,12 @@ ${lanes.join("\n")}
|
|
|
31763
31767
|
if (languageVariant === 1 /* JSX */) {
|
|
31764
31768
|
return parseJsxElementOrSelfClosingElementOrFragment(
|
|
31765
31769
|
/*inExpressionContext*/
|
|
31770
|
+
true,
|
|
31771
|
+
/*topInvalidNodePosition*/
|
|
31772
|
+
void 0,
|
|
31773
|
+
/*openingTag*/
|
|
31774
|
+
void 0,
|
|
31775
|
+
/*mustBeUnary*/
|
|
31766
31776
|
true
|
|
31767
31777
|
);
|
|
31768
31778
|
}
|
|
@@ -31867,7 +31877,7 @@ ${lanes.join("\n")}
|
|
|
31867
31877
|
true
|
|
31868
31878
|
)), pos);
|
|
31869
31879
|
}
|
|
31870
|
-
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag) {
|
|
31880
|
+
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag, mustBeUnary = false) {
|
|
31871
31881
|
const pos = getNodePos();
|
|
31872
31882
|
const opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
|
|
31873
31883
|
let result;
|
|
@@ -31905,7 +31915,7 @@ ${lanes.join("\n")}
|
|
|
31905
31915
|
Debug.assert(opening.kind === 283 /* JsxSelfClosingElement */);
|
|
31906
31916
|
result = opening;
|
|
31907
31917
|
}
|
|
31908
|
-
if (inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
31918
|
+
if (!mustBeUnary && inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
31909
31919
|
const topBadPos = typeof topInvalidNodePosition === "undefined" ? result.pos : topInvalidNodePosition;
|
|
31910
31920
|
const invalidElement = tryParse(() => parseJsxElementOrSelfClosingElementOrFragment(
|
|
31911
31921
|
/*inExpressionContext*/
|
|
@@ -31938,7 +31948,7 @@ ${lanes.join("\n")}
|
|
|
31938
31948
|
parseErrorAtRange(openingTag, Diagnostics.JSX_fragment_has_no_corresponding_closing_tag);
|
|
31939
31949
|
} else {
|
|
31940
31950
|
const tag = openingTag.tagName;
|
|
31941
|
-
const start = skipTrivia(sourceText, tag.pos);
|
|
31951
|
+
const start = Math.min(skipTrivia(sourceText, tag.pos), tag.end);
|
|
31942
31952
|
parseErrorAt(start, tag.end, Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, getTextOfNodeFromSourceText(sourceText, openingTag.tagName));
|
|
31943
31953
|
}
|
|
31944
31954
|
return void 0;
|
|
@@ -44229,7 +44239,7 @@ ${lanes.join("\n")}
|
|
|
44229
44239
|
return [2 /* JsExtension */];
|
|
44230
44240
|
}
|
|
44231
44241
|
if (getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */) {
|
|
44232
|
-
return [1 /* Index */, 2 /* JsExtension */];
|
|
44242
|
+
return preferredEnding === 2 /* JsExtension */ ? [2 /* JsExtension */, 1 /* Index */] : [1 /* Index */, 2 /* JsExtension */];
|
|
44233
44243
|
}
|
|
44234
44244
|
switch (preferredEnding) {
|
|
44235
44245
|
case 2 /* JsExtension */:
|
|
@@ -75085,7 +75095,7 @@ ${lanes.join("\n")}
|
|
|
75085
75095
|
}
|
|
75086
75096
|
return getUnaryResultType(operandType);
|
|
75087
75097
|
case 53 /* ExclamationToken */:
|
|
75088
|
-
|
|
75098
|
+
checkTruthinessOfType(operandType, node.operand);
|
|
75089
75099
|
const facts = getTypeFacts(operandType) & (4194304 /* Truthy */ | 8388608 /* Falsy */);
|
|
75090
75100
|
return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
|
|
75091
75101
|
case 45 /* PlusPlusToken */:
|
|
@@ -92342,11 +92352,12 @@ ${lanes.join("\n")}
|
|
|
92342
92352
|
return visitEachChild(node, visitor, context);
|
|
92343
92353
|
}
|
|
92344
92354
|
function visitArrayAssignmentElement(node) {
|
|
92345
|
-
|
|
92346
|
-
|
|
92347
|
-
|
|
92348
|
-
|
|
92349
|
-
|
|
92355
|
+
if (isArrayBindingOrAssignmentElement(node)) {
|
|
92356
|
+
if (isSpreadElement(node))
|
|
92357
|
+
return visitAssignmentRestElement(node);
|
|
92358
|
+
if (!isOmittedExpression(node))
|
|
92359
|
+
return visitAssignmentElement(node);
|
|
92360
|
+
}
|
|
92350
92361
|
return visitEachChild(node, visitor, context);
|
|
92351
92362
|
}
|
|
92352
92363
|
function visitAssignmentProperty(node) {
|
|
@@ -118512,9 +118523,6 @@ ${lanes.join("\n")}
|
|
|
118512
118523
|
if (moduleKind === 2 /* AMD */ || moduleKind === 3 /* UMD */ || moduleKind === 4 /* System */) {
|
|
118513
118524
|
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
|
|
118514
118525
|
}
|
|
118515
|
-
if (options.isolatedModules) {
|
|
118516
|
-
createRedundantOptionDiagnostic("isolatedModules", "verbatimModuleSyntax");
|
|
118517
|
-
}
|
|
118518
118526
|
if (options.preserveValueImports) {
|
|
118519
118527
|
createRedundantOptionDiagnostic("preserveValueImports", "verbatimModuleSyntax");
|
|
118520
118528
|
}
|
|
@@ -121211,7 +121219,7 @@ ${lanes.join("\n")}
|
|
|
121211
121219
|
return {
|
|
121212
121220
|
dir: rootDir,
|
|
121213
121221
|
dirPath: rootPath,
|
|
121214
|
-
nonRecursive:
|
|
121222
|
+
nonRecursive: true
|
|
121215
121223
|
};
|
|
121216
121224
|
}
|
|
121217
121225
|
}
|
|
@@ -121659,7 +121667,7 @@ ${lanes.join("\n")}
|
|
|
121659
121667
|
customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
|
|
121660
121668
|
}
|
|
121661
121669
|
if (dirPath === rootPath) {
|
|
121662
|
-
Debug.assert(
|
|
121670
|
+
Debug.assert(nonRecursive);
|
|
121663
121671
|
setAtRoot = true;
|
|
121664
121672
|
} else {
|
|
121665
121673
|
setDirectoryWatcher(dir, dirPath, nonRecursive);
|
|
@@ -179750,6 +179758,7 @@ ${e.message}`;
|
|
|
179750
179758
|
extendsHelper: () => extendsHelper,
|
|
179751
179759
|
extensionFromPath: () => extensionFromPath,
|
|
179752
179760
|
extensionIsTS: () => extensionIsTS,
|
|
179761
|
+
extensionsNotSupportingExtensionlessResolution: () => extensionsNotSupportingExtensionlessResolution,
|
|
179753
179762
|
externalHelpersModuleNameText: () => externalHelpersModuleNameText,
|
|
179754
179763
|
factory: () => factory,
|
|
179755
179764
|
fileExtensionIs: () => fileExtensionIs,
|
|
@@ -182115,6 +182124,7 @@ ${e.message}`;
|
|
|
182115
182124
|
extendsHelper: () => extendsHelper,
|
|
182116
182125
|
extensionFromPath: () => extensionFromPath,
|
|
182117
182126
|
extensionIsTS: () => extensionIsTS,
|
|
182127
|
+
extensionsNotSupportingExtensionlessResolution: () => extensionsNotSupportingExtensionlessResolution,
|
|
182118
182128
|
externalHelpersModuleNameText: () => externalHelpersModuleNameText,
|
|
182119
182129
|
factory: () => factory,
|
|
182120
182130
|
fileExtensionIs: () => fileExtensionIs,
|
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.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230407`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -18444,7 +18444,7 @@ ${lanes.join("\n")}
|
|
|
18444
18444
|
return some(supportedTSExtensionsFlat, (extension) => fileExtensionIs(fileName, extension));
|
|
18445
18445
|
}
|
|
18446
18446
|
function usesExtensionsOnImports({ imports }, hasExtension2 = or(hasJSFileExtension, hasTSFileExtension)) {
|
|
18447
|
-
return firstDefined(imports, ({ text }) => pathIsRelative(text) ? hasExtension2(text) : void 0) || false;
|
|
18447
|
+
return firstDefined(imports, ({ text }) => pathIsRelative(text) && !fileExtensionIsOneOf(text, extensionsNotSupportingExtensionlessResolution) ? hasExtension2(text) : void 0) || false;
|
|
18448
18448
|
}
|
|
18449
18449
|
function getModuleSpecifierEndingPreference(preference, resolutionMode, compilerOptions, sourceFile) {
|
|
18450
18450
|
if (preference === "js" || resolutionMode === 99 /* ESNext */) {
|
|
@@ -18468,6 +18468,9 @@ ${lanes.join("\n")}
|
|
|
18468
18468
|
const specifiers = sourceFile.imports.length ? sourceFile.imports.map((i) => i.text) : isSourceFileJS(sourceFile) ? getRequiresAtTopOfFile(sourceFile).map((r) => r.arguments[0].text) : emptyArray;
|
|
18469
18469
|
for (const specifier of specifiers) {
|
|
18470
18470
|
if (pathIsRelative(specifier)) {
|
|
18471
|
+
if (fileExtensionIsOneOf(specifier, extensionsNotSupportingExtensionlessResolution)) {
|
|
18472
|
+
continue;
|
|
18473
|
+
}
|
|
18471
18474
|
if (hasTSFileExtension(specifier)) {
|
|
18472
18475
|
return 3 /* TsExtension */;
|
|
18473
18476
|
}
|
|
@@ -19098,7 +19101,7 @@ ${lanes.join("\n")}
|
|
|
19098
19101
|
const tag = getJSDocSatisfiesTag(node);
|
|
19099
19102
|
return tag && tag.typeExpression && tag.typeExpression.type;
|
|
19100
19103
|
}
|
|
19101
|
-
var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashAMDReferencePathRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, objectAllocator, objectAllocatorPatchers, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries;
|
|
19104
|
+
var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashAMDReferencePathRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, objectAllocator, objectAllocatorPatchers, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, extensionsNotSupportingExtensionlessResolution, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries;
|
|
19102
19105
|
var init_utilities = __esm({
|
|
19103
19106
|
"src/compiler/utilities.ts"() {
|
|
19104
19107
|
"use strict";
|
|
@@ -19262,6 +19265,7 @@ ${lanes.join("\n")}
|
|
|
19262
19265
|
allSupportedExtensionsWithJson = [...allSupportedExtensions, [".json" /* Json */]];
|
|
19263
19266
|
supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */];
|
|
19264
19267
|
supportedTSImplementationExtensions = [".ts" /* Ts */, ".cts" /* Cts */, ".mts" /* Mts */, ".tsx" /* Tsx */];
|
|
19268
|
+
extensionsNotSupportingExtensionlessResolution = [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */];
|
|
19265
19269
|
ModuleSpecifierEnding = /* @__PURE__ */ ((ModuleSpecifierEnding2) => {
|
|
19266
19270
|
ModuleSpecifierEnding2[ModuleSpecifierEnding2["Minimal"] = 0] = "Minimal";
|
|
19267
19271
|
ModuleSpecifierEnding2[ModuleSpecifierEnding2["Index"] = 1] = "Index";
|
|
@@ -31763,6 +31767,12 @@ ${lanes.join("\n")}
|
|
|
31763
31767
|
if (languageVariant === 1 /* JSX */) {
|
|
31764
31768
|
return parseJsxElementOrSelfClosingElementOrFragment(
|
|
31765
31769
|
/*inExpressionContext*/
|
|
31770
|
+
true,
|
|
31771
|
+
/*topInvalidNodePosition*/
|
|
31772
|
+
void 0,
|
|
31773
|
+
/*openingTag*/
|
|
31774
|
+
void 0,
|
|
31775
|
+
/*mustBeUnary*/
|
|
31766
31776
|
true
|
|
31767
31777
|
);
|
|
31768
31778
|
}
|
|
@@ -31867,7 +31877,7 @@ ${lanes.join("\n")}
|
|
|
31867
31877
|
true
|
|
31868
31878
|
)), pos);
|
|
31869
31879
|
}
|
|
31870
|
-
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag) {
|
|
31880
|
+
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag, mustBeUnary = false) {
|
|
31871
31881
|
const pos = getNodePos();
|
|
31872
31882
|
const opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
|
|
31873
31883
|
let result;
|
|
@@ -31905,7 +31915,7 @@ ${lanes.join("\n")}
|
|
|
31905
31915
|
Debug.assert(opening.kind === 283 /* JsxSelfClosingElement */);
|
|
31906
31916
|
result = opening;
|
|
31907
31917
|
}
|
|
31908
|
-
if (inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
31918
|
+
if (!mustBeUnary && inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
31909
31919
|
const topBadPos = typeof topInvalidNodePosition === "undefined" ? result.pos : topInvalidNodePosition;
|
|
31910
31920
|
const invalidElement = tryParse(() => parseJsxElementOrSelfClosingElementOrFragment(
|
|
31911
31921
|
/*inExpressionContext*/
|
|
@@ -31938,7 +31948,7 @@ ${lanes.join("\n")}
|
|
|
31938
31948
|
parseErrorAtRange(openingTag, Diagnostics.JSX_fragment_has_no_corresponding_closing_tag);
|
|
31939
31949
|
} else {
|
|
31940
31950
|
const tag = openingTag.tagName;
|
|
31941
|
-
const start = skipTrivia(sourceText, tag.pos);
|
|
31951
|
+
const start = Math.min(skipTrivia(sourceText, tag.pos), tag.end);
|
|
31942
31952
|
parseErrorAt(start, tag.end, Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, getTextOfNodeFromSourceText(sourceText, openingTag.tagName));
|
|
31943
31953
|
}
|
|
31944
31954
|
return void 0;
|
|
@@ -44229,7 +44239,7 @@ ${lanes.join("\n")}
|
|
|
44229
44239
|
return [2 /* JsExtension */];
|
|
44230
44240
|
}
|
|
44231
44241
|
if (getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */) {
|
|
44232
|
-
return [1 /* Index */, 2 /* JsExtension */];
|
|
44242
|
+
return preferredEnding === 2 /* JsExtension */ ? [2 /* JsExtension */, 1 /* Index */] : [1 /* Index */, 2 /* JsExtension */];
|
|
44233
44243
|
}
|
|
44234
44244
|
switch (preferredEnding) {
|
|
44235
44245
|
case 2 /* JsExtension */:
|
|
@@ -75085,7 +75095,7 @@ ${lanes.join("\n")}
|
|
|
75085
75095
|
}
|
|
75086
75096
|
return getUnaryResultType(operandType);
|
|
75087
75097
|
case 53 /* ExclamationToken */:
|
|
75088
|
-
|
|
75098
|
+
checkTruthinessOfType(operandType, node.operand);
|
|
75089
75099
|
const facts = getTypeFacts(operandType) & (4194304 /* Truthy */ | 8388608 /* Falsy */);
|
|
75090
75100
|
return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
|
|
75091
75101
|
case 45 /* PlusPlusToken */:
|
|
@@ -92342,11 +92352,12 @@ ${lanes.join("\n")}
|
|
|
92342
92352
|
return visitEachChild(node, visitor, context);
|
|
92343
92353
|
}
|
|
92344
92354
|
function visitArrayAssignmentElement(node) {
|
|
92345
|
-
|
|
92346
|
-
|
|
92347
|
-
|
|
92348
|
-
|
|
92349
|
-
|
|
92355
|
+
if (isArrayBindingOrAssignmentElement(node)) {
|
|
92356
|
+
if (isSpreadElement(node))
|
|
92357
|
+
return visitAssignmentRestElement(node);
|
|
92358
|
+
if (!isOmittedExpression(node))
|
|
92359
|
+
return visitAssignmentElement(node);
|
|
92360
|
+
}
|
|
92350
92361
|
return visitEachChild(node, visitor, context);
|
|
92351
92362
|
}
|
|
92352
92363
|
function visitAssignmentProperty(node) {
|
|
@@ -118512,9 +118523,6 @@ ${lanes.join("\n")}
|
|
|
118512
118523
|
if (moduleKind === 2 /* AMD */ || moduleKind === 3 /* UMD */ || moduleKind === 4 /* System */) {
|
|
118513
118524
|
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
|
|
118514
118525
|
}
|
|
118515
|
-
if (options.isolatedModules) {
|
|
118516
|
-
createRedundantOptionDiagnostic("isolatedModules", "verbatimModuleSyntax");
|
|
118517
|
-
}
|
|
118518
118526
|
if (options.preserveValueImports) {
|
|
118519
118527
|
createRedundantOptionDiagnostic("preserveValueImports", "verbatimModuleSyntax");
|
|
118520
118528
|
}
|
|
@@ -121211,7 +121219,7 @@ ${lanes.join("\n")}
|
|
|
121211
121219
|
return {
|
|
121212
121220
|
dir: rootDir,
|
|
121213
121221
|
dirPath: rootPath,
|
|
121214
|
-
nonRecursive:
|
|
121222
|
+
nonRecursive: true
|
|
121215
121223
|
};
|
|
121216
121224
|
}
|
|
121217
121225
|
}
|
|
@@ -121659,7 +121667,7 @@ ${lanes.join("\n")}
|
|
|
121659
121667
|
customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
|
|
121660
121668
|
}
|
|
121661
121669
|
if (dirPath === rootPath) {
|
|
121662
|
-
Debug.assert(
|
|
121670
|
+
Debug.assert(nonRecursive);
|
|
121663
121671
|
setAtRoot = true;
|
|
121664
121672
|
} else {
|
|
121665
121673
|
setDirectoryWatcher(dir, dirPath, nonRecursive);
|
|
@@ -168914,6 +168922,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168914
168922
|
extendsHelper: () => extendsHelper,
|
|
168915
168923
|
extensionFromPath: () => extensionFromPath,
|
|
168916
168924
|
extensionIsTS: () => extensionIsTS,
|
|
168925
|
+
extensionsNotSupportingExtensionlessResolution: () => extensionsNotSupportingExtensionlessResolution,
|
|
168917
168926
|
externalHelpersModuleNameText: () => externalHelpersModuleNameText,
|
|
168918
168927
|
factory: () => factory,
|
|
168919
168928
|
fileExtensionIs: () => fileExtensionIs,
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.1";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20230407`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -11483,6 +11483,7 @@ var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts
|
|
|
11483
11483
|
var allSupportedExtensionsWithJson = [...allSupportedExtensions, [".json" /* Json */]];
|
|
11484
11484
|
var supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */];
|
|
11485
11485
|
var supportedTSImplementationExtensions = [".ts" /* Ts */, ".cts" /* Cts */, ".mts" /* Mts */, ".tsx" /* Tsx */];
|
|
11486
|
+
var extensionsNotSupportingExtensionlessResolution = [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */];
|
|
11486
11487
|
function hasJSFileExtension(fileName) {
|
|
11487
11488
|
return some(supportedJSExtensionsFlat, (extension) => fileExtensionIs(fileName, extension));
|
|
11488
11489
|
}
|
|
@@ -21340,6 +21341,12 @@ var Parser;
|
|
|
21340
21341
|
if (languageVariant === 1 /* JSX */) {
|
|
21341
21342
|
return parseJsxElementOrSelfClosingElementOrFragment(
|
|
21342
21343
|
/*inExpressionContext*/
|
|
21344
|
+
true,
|
|
21345
|
+
/*topInvalidNodePosition*/
|
|
21346
|
+
void 0,
|
|
21347
|
+
/*openingTag*/
|
|
21348
|
+
void 0,
|
|
21349
|
+
/*mustBeUnary*/
|
|
21343
21350
|
true
|
|
21344
21351
|
);
|
|
21345
21352
|
}
|
|
@@ -21444,7 +21451,7 @@ var Parser;
|
|
|
21444
21451
|
true
|
|
21445
21452
|
)), pos);
|
|
21446
21453
|
}
|
|
21447
|
-
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag) {
|
|
21454
|
+
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag, mustBeUnary = false) {
|
|
21448
21455
|
const pos = getNodePos();
|
|
21449
21456
|
const opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
|
|
21450
21457
|
let result;
|
|
@@ -21482,7 +21489,7 @@ var Parser;
|
|
|
21482
21489
|
Debug.assert(opening.kind === 283 /* JsxSelfClosingElement */);
|
|
21483
21490
|
result = opening;
|
|
21484
21491
|
}
|
|
21485
|
-
if (inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
21492
|
+
if (!mustBeUnary && inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
21486
21493
|
const topBadPos = typeof topInvalidNodePosition === "undefined" ? result.pos : topInvalidNodePosition;
|
|
21487
21494
|
const invalidElement = tryParse(() => parseJsxElementOrSelfClosingElementOrFragment(
|
|
21488
21495
|
/*inExpressionContext*/
|
|
@@ -21515,7 +21522,7 @@ var Parser;
|
|
|
21515
21522
|
parseErrorAtRange(openingTag, Diagnostics.JSX_fragment_has_no_corresponding_closing_tag);
|
|
21516
21523
|
} else {
|
|
21517
21524
|
const tag = openingTag.tagName;
|
|
21518
|
-
const start = skipTrivia(sourceText, tag.pos);
|
|
21525
|
+
const start = Math.min(skipTrivia(sourceText, tag.pos), tag.end);
|
|
21519
21526
|
parseErrorAt(start, tag.end, Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, getTextOfNodeFromSourceText(sourceText, openingTag.tagName));
|
|
21520
21527
|
}
|
|
21521
21528
|
return void 0;
|
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.1.0-dev.
|
|
5
|
+
"version": "5.1.0-dev.20230407",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "14.21.1",
|
|
114
114
|
"npm": "8.19.3"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "85f20246a4a2b424f7d92b463c20886ddf7488f9"
|
|
117
117
|
}
|