typescript 5.6.0-dev.20240701 → 5.6.0-dev.20240703
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 +14 -1
- package/lib/typescript.js +33 -11
- package/package.json +3 -3
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.6";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240703`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -59724,6 +59724,12 @@ function createTypeChecker(host) {
|
|
|
59724
59724
|
function eachUnionContains(unionTypes2, type) {
|
|
59725
59725
|
for (const u of unionTypes2) {
|
|
59726
59726
|
if (!containsType(u.types, type)) {
|
|
59727
|
+
if (type === missingType) {
|
|
59728
|
+
return containsType(u.types, undefinedType);
|
|
59729
|
+
}
|
|
59730
|
+
if (type === undefinedType) {
|
|
59731
|
+
return containsType(u.types, missingType);
|
|
59732
|
+
}
|
|
59727
59733
|
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & (32 /* Enum */ | 256 /* NumberLiteral */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
|
|
59728
59734
|
if (!primitive || !containsType(u.types, primitive)) {
|
|
59729
59735
|
return false;
|
|
@@ -59780,6 +59786,13 @@ function createTypeChecker(host) {
|
|
|
59780
59786
|
for (const t of u.types) {
|
|
59781
59787
|
if (insertType(checked, t)) {
|
|
59782
59788
|
if (eachUnionContains(unionTypes2, t)) {
|
|
59789
|
+
if (t === undefinedType && result.length && result[0] === missingType) {
|
|
59790
|
+
continue;
|
|
59791
|
+
}
|
|
59792
|
+
if (t === missingType && result.length && result[0] === undefinedType) {
|
|
59793
|
+
result[0] = missingType;
|
|
59794
|
+
continue;
|
|
59795
|
+
}
|
|
59783
59796
|
insertType(result, t);
|
|
59784
59797
|
}
|
|
59785
59798
|
}
|
package/lib/typescript.js
CHANGED
|
@@ -2250,7 +2250,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2250
2250
|
|
|
2251
2251
|
// src/compiler/corePublic.ts
|
|
2252
2252
|
var versionMajorMinor = "5.6";
|
|
2253
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2253
|
+
var version = `${versionMajorMinor}.0-dev.20240703`;
|
|
2254
2254
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2255
2255
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2256
2256
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -64312,6 +64312,12 @@ function createTypeChecker(host) {
|
|
|
64312
64312
|
function eachUnionContains(unionTypes2, type) {
|
|
64313
64313
|
for (const u of unionTypes2) {
|
|
64314
64314
|
if (!containsType(u.types, type)) {
|
|
64315
|
+
if (type === missingType) {
|
|
64316
|
+
return containsType(u.types, undefinedType);
|
|
64317
|
+
}
|
|
64318
|
+
if (type === undefinedType) {
|
|
64319
|
+
return containsType(u.types, missingType);
|
|
64320
|
+
}
|
|
64315
64321
|
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & (32 /* Enum */ | 256 /* NumberLiteral */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
|
|
64316
64322
|
if (!primitive || !containsType(u.types, primitive)) {
|
|
64317
64323
|
return false;
|
|
@@ -64368,6 +64374,13 @@ function createTypeChecker(host) {
|
|
|
64368
64374
|
for (const t of u.types) {
|
|
64369
64375
|
if (insertType(checked, t)) {
|
|
64370
64376
|
if (eachUnionContains(unionTypes2, t)) {
|
|
64377
|
+
if (t === undefinedType && result.length && result[0] === missingType) {
|
|
64378
|
+
continue;
|
|
64379
|
+
}
|
|
64380
|
+
if (t === missingType && result.length && result[0] === undefinedType) {
|
|
64381
|
+
result[0] = missingType;
|
|
64382
|
+
continue;
|
|
64383
|
+
}
|
|
64371
64384
|
insertType(result, t);
|
|
64372
64385
|
}
|
|
64373
64386
|
}
|
|
@@ -144056,7 +144069,7 @@ function isPureImport(node) {
|
|
|
144056
144069
|
return false;
|
|
144057
144070
|
}
|
|
144058
144071
|
}
|
|
144059
|
-
function getUsageInfo(oldFile, toMove, checker, existingTargetLocals = /* @__PURE__ */ new Set()) {
|
|
144072
|
+
function getUsageInfo(oldFile, toMove, checker, existingTargetLocals = /* @__PURE__ */ new Set(), enclosingRange) {
|
|
144060
144073
|
var _a;
|
|
144061
144074
|
const movedSymbols = /* @__PURE__ */ new Set();
|
|
144062
144075
|
const oldImportsNeededByTargetFile = /* @__PURE__ */ new Map();
|
|
@@ -144072,7 +144085,7 @@ function getUsageInfo(oldFile, toMove, checker, existingTargetLocals = /* @__PUR
|
|
|
144072
144085
|
}
|
|
144073
144086
|
const unusedImportsFromOldFile = /* @__PURE__ */ new Set();
|
|
144074
144087
|
for (const statement of toMove) {
|
|
144075
|
-
forEachReference(statement, checker, (symbol, isValidTypeOnlyUseSite) => {
|
|
144088
|
+
forEachReference(statement, checker, enclosingRange, (symbol, isValidTypeOnlyUseSite) => {
|
|
144076
144089
|
if (!symbol.declarations || isGlobalType(checker, symbol)) {
|
|
144077
144090
|
return;
|
|
144078
144091
|
}
|
|
@@ -144102,7 +144115,7 @@ function getUsageInfo(oldFile, toMove, checker, existingTargetLocals = /* @__PUR
|
|
|
144102
144115
|
if (jsxNamespaceSymbol && !!(statement.transformFlags & 2 /* ContainsJsx */)) {
|
|
144103
144116
|
unusedImportsFromOldFile.delete(jsxNamespaceSymbol);
|
|
144104
144117
|
}
|
|
144105
|
-
forEachReference(statement, checker, (symbol, isValidTypeOnlyUseSite) => {
|
|
144118
|
+
forEachReference(statement, checker, enclosingRange, (symbol, isValidTypeOnlyUseSite) => {
|
|
144106
144119
|
if (movedSymbols.has(symbol)) oldFileImportsFromTargetFile.set(symbol, isValidTypeOnlyUseSite);
|
|
144107
144120
|
unusedImportsFromOldFile.delete(symbol);
|
|
144108
144121
|
});
|
|
@@ -144144,9 +144157,12 @@ function makeUniqueFilename(proposedFilename, extension, inDirectory, host) {
|
|
|
144144
144157
|
function inferNewFileName(importsFromNewFile, movedSymbols) {
|
|
144145
144158
|
return forEachKey(importsFromNewFile, symbolNameNoDefault) || forEachKey(movedSymbols, symbolNameNoDefault) || "newFile";
|
|
144146
144159
|
}
|
|
144147
|
-
function forEachReference(node, checker, onReference) {
|
|
144160
|
+
function forEachReference(node, checker, enclosingRange, onReference) {
|
|
144148
144161
|
node.forEachChild(function cb(node2) {
|
|
144149
144162
|
if (isIdentifier(node2) && !isDeclarationName(node2)) {
|
|
144163
|
+
if (enclosingRange && !rangeContainsRange(enclosingRange, node2)) {
|
|
144164
|
+
return;
|
|
144165
|
+
}
|
|
144150
144166
|
const sym = checker.getSymbolAtLocation(node2);
|
|
144151
144167
|
if (sym) onReference(sym, isValidTypeOnlyAliasUseSite(node2));
|
|
144152
144168
|
} else {
|
|
@@ -144309,12 +144325,18 @@ function getExistingLocals(sourceFile, statements, checker) {
|
|
|
144309
144325
|
}
|
|
144310
144326
|
}
|
|
144311
144327
|
for (const statement of statements) {
|
|
144312
|
-
forEachReference(
|
|
144313
|
-
|
|
144314
|
-
|
|
144315
|
-
|
|
144328
|
+
forEachReference(
|
|
144329
|
+
statement,
|
|
144330
|
+
checker,
|
|
144331
|
+
/*enclosingRange*/
|
|
144332
|
+
void 0,
|
|
144333
|
+
(s) => {
|
|
144334
|
+
const symbol = skipAlias(s, checker);
|
|
144335
|
+
if (symbol.valueDeclaration && getSourceFileOfNode(symbol.valueDeclaration).path === sourceFile.path) {
|
|
144336
|
+
existingLocals.add(symbol);
|
|
144337
|
+
}
|
|
144316
144338
|
}
|
|
144317
|
-
|
|
144339
|
+
);
|
|
144318
144340
|
}
|
|
144319
144341
|
return existingLocals;
|
|
144320
144342
|
}
|
|
@@ -178388,7 +178410,7 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
|
|
|
178388
178410
|
}
|
|
178389
178411
|
statements.push(...statementsInSourceFile.slice(startNodeIndex, endNodeIndex === -1 ? statementsInSourceFile.length : endNodeIndex + 1));
|
|
178390
178412
|
});
|
|
178391
|
-
const usage = getUsageInfo(copiedFrom.file, statements, originalProgram.getTypeChecker(), getExistingLocals(updatedFile, statements, originalProgram.getTypeChecker()));
|
|
178413
|
+
const usage = getUsageInfo(copiedFrom.file, statements, originalProgram.getTypeChecker(), getExistingLocals(updatedFile, statements, originalProgram.getTypeChecker()), { pos: copiedFrom.range[0].pos, end: copiedFrom.range[copiedFrom.range.length - 1].end });
|
|
178392
178414
|
Debug.assertIsDefined(originalProgram);
|
|
178393
178415
|
const useEsModuleSyntax = !fileShouldUseJavaScriptRequire(targetFile.fileName, originalProgram, host, !!copiedFrom.file.commonJsModuleIndicator);
|
|
178394
178416
|
addExportsInOldFile(copiedFrom.file, usage.targetFileImportsFromOldFile, changes, useEsModuleSyntax);
|
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.6.0-dev.
|
|
5
|
+
"version": "5.6.0-dev.20240703",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"chokidar": "^3.6.0",
|
|
61
61
|
"diff": "^5.2.0",
|
|
62
62
|
"dprint": "^0.46.3",
|
|
63
|
-
"esbuild": "^0.
|
|
63
|
+
"esbuild": "^0.22.0",
|
|
64
64
|
"eslint": "^8.57.0",
|
|
65
65
|
"eslint-formatter-autolinkable-stylish": "^1.3.0",
|
|
66
66
|
"fast-xml-parser": "^4.4.0",
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "20.1.0",
|
|
114
114
|
"npm": "8.19.4"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "7bd7dfc007999f6ed2ab0491821d9d136b6293d4"
|
|
117
117
|
}
|