typescript 5.5.0-dev.20240501 → 5.5.0-dev.20240503
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 +29 -18
- package/lib/typescript.js +41 -18
- 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.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240503`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -13534,7 +13534,7 @@ function entityNameToString(name) {
|
|
|
13534
13534
|
return Debug.assertNever(name.name);
|
|
13535
13535
|
}
|
|
13536
13536
|
case 311 /* JSDocMemberName */:
|
|
13537
|
-
return entityNameToString(name.left) + entityNameToString(name.right);
|
|
13537
|
+
return entityNameToString(name.left) + "#" + entityNameToString(name.right);
|
|
13538
13538
|
case 295 /* JsxNamespacedName */:
|
|
13539
13539
|
return entityNameToString(name.namespace) + ":" + entityNameToString(name.name);
|
|
13540
13540
|
default:
|
|
@@ -36968,6 +36968,10 @@ var configDirTemplateSubstitutionOptions = optionDeclarations.filter(
|
|
|
36968
36968
|
var configDirTemplateSubstitutionWatchOptions = optionsForWatch.filter(
|
|
36969
36969
|
(option) => option.allowConfigDirTemplateSubstitution || !option.isCommandLineOnly && option.isFilePath
|
|
36970
36970
|
);
|
|
36971
|
+
var commandLineOptionOfCustomType = optionDeclarations.filter(isCommandLineOptionOfCustomType);
|
|
36972
|
+
function isCommandLineOptionOfCustomType(option) {
|
|
36973
|
+
return !isString(option.type);
|
|
36974
|
+
}
|
|
36971
36975
|
var optionsForBuild = [
|
|
36972
36976
|
{
|
|
36973
36977
|
name: "verbose",
|
|
@@ -56902,7 +56906,7 @@ function createTypeChecker(host) {
|
|
|
56902
56906
|
}
|
|
56903
56907
|
}
|
|
56904
56908
|
return getNormalizedType(
|
|
56905
|
-
getIntersectionType(constraints),
|
|
56909
|
+
getIntersectionType(constraints, 2 /* NoConstraintReduction */),
|
|
56906
56910
|
/*writing*/
|
|
56907
56911
|
false
|
|
56908
56912
|
);
|
|
@@ -59707,7 +59711,7 @@ function createTypeChecker(host) {
|
|
|
59707
59711
|
result.aliasTypeArguments = aliasTypeArguments;
|
|
59708
59712
|
return result;
|
|
59709
59713
|
}
|
|
59710
|
-
function getIntersectionType(types, aliasSymbol, aliasTypeArguments
|
|
59714
|
+
function getIntersectionType(types, flags = 0 /* None */, aliasSymbol, aliasTypeArguments) {
|
|
59711
59715
|
const typeMembershipMap = /* @__PURE__ */ new Map();
|
|
59712
59716
|
const includes = addTypesToIntersection(typeMembershipMap, 0, types);
|
|
59713
59717
|
const typeSet = arrayFrom(typeMembershipMap.values());
|
|
@@ -59728,7 +59732,7 @@ function createTypeChecker(host) {
|
|
|
59728
59732
|
return includes & 16777216 /* IncludesEmptyObject */ ? neverType : includes & 32768 /* Undefined */ ? undefinedType : nullType;
|
|
59729
59733
|
}
|
|
59730
59734
|
if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ || includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ || includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ || includes & 16384 /* Void */ && includes & 32768 /* Undefined */ || includes & 16777216 /* IncludesEmptyObject */ && includes & 470302716 /* DefinitelyNonNullable */) {
|
|
59731
|
-
if (!
|
|
59735
|
+
if (!(flags & 1 /* NoSupertypeReduction */))
|
|
59732
59736
|
removeRedundantSupertypes(typeSet, includes);
|
|
59733
59737
|
}
|
|
59734
59738
|
if (includes & 262144 /* IncludesMissingType */) {
|
|
@@ -59740,7 +59744,7 @@ function createTypeChecker(host) {
|
|
|
59740
59744
|
if (typeSet.length === 1) {
|
|
59741
59745
|
return typeSet[0];
|
|
59742
59746
|
}
|
|
59743
|
-
if (typeSet.length === 2) {
|
|
59747
|
+
if (typeSet.length === 2 && !(flags & 2 /* NoConstraintReduction */)) {
|
|
59744
59748
|
const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
59745
59749
|
const typeVariable = typeSet[typeVarIndex];
|
|
59746
59750
|
const primitiveType = typeSet[1 - typeVarIndex];
|
|
@@ -59759,27 +59763,27 @@ function createTypeChecker(host) {
|
|
|
59759
59763
|
}
|
|
59760
59764
|
}
|
|
59761
59765
|
}
|
|
59762
|
-
const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
59766
|
+
const id = getTypeListId(typeSet) + (flags & 2 /* NoConstraintReduction */ ? "*" : getAliasId(aliasSymbol, aliasTypeArguments));
|
|
59763
59767
|
let result = intersectionTypes.get(id);
|
|
59764
59768
|
if (!result) {
|
|
59765
59769
|
if (includes & 1048576 /* Union */) {
|
|
59766
59770
|
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
|
|
59767
|
-
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
59771
|
+
result = getIntersectionType(typeSet, flags, aliasSymbol, aliasTypeArguments);
|
|
59768
59772
|
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && t.types[0].flags & 32768 /* Undefined */))) {
|
|
59769
59773
|
const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType;
|
|
59770
59774
|
removeFromEach(typeSet, 32768 /* Undefined */);
|
|
59771
|
-
result = getUnionType([getIntersectionType(typeSet), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
59775
|
+
result = getUnionType([getIntersectionType(typeSet, flags), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
59772
59776
|
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
|
|
59773
59777
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
59774
|
-
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
59778
|
+
result = getUnionType([getIntersectionType(typeSet, flags), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
59775
59779
|
} else if (typeSet.length >= 4) {
|
|
59776
59780
|
const middle = Math.floor(typeSet.length / 2);
|
|
59777
|
-
result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle)), getIntersectionType(typeSet.slice(middle))], aliasSymbol, aliasTypeArguments);
|
|
59781
|
+
result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle), flags), getIntersectionType(typeSet.slice(middle), flags)], flags, aliasSymbol, aliasTypeArguments);
|
|
59778
59782
|
} else {
|
|
59779
59783
|
if (!checkCrossProductUnion(typeSet)) {
|
|
59780
59784
|
return errorType;
|
|
59781
59785
|
}
|
|
59782
|
-
const constituents = getCrossProductIntersections(typeSet);
|
|
59786
|
+
const constituents = getCrossProductIntersections(typeSet, flags);
|
|
59783
59787
|
const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : void 0;
|
|
59784
59788
|
result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
|
|
59785
59789
|
}
|
|
@@ -59803,7 +59807,7 @@ function createTypeChecker(host) {
|
|
|
59803
59807
|
}
|
|
59804
59808
|
return true;
|
|
59805
59809
|
}
|
|
59806
|
-
function getCrossProductIntersections(types) {
|
|
59810
|
+
function getCrossProductIntersections(types, flags) {
|
|
59807
59811
|
const count = getCrossProductUnionSize(types);
|
|
59808
59812
|
const intersections = [];
|
|
59809
59813
|
for (let i = 0; i < count; i++) {
|
|
@@ -59817,7 +59821,7 @@ function createTypeChecker(host) {
|
|
|
59817
59821
|
n = Math.floor(n / length2);
|
|
59818
59822
|
}
|
|
59819
59823
|
}
|
|
59820
|
-
const t = getIntersectionType(constituents);
|
|
59824
|
+
const t = getIntersectionType(constituents, flags);
|
|
59821
59825
|
if (!(t.flags & 131072 /* Never */))
|
|
59822
59826
|
intersections.push(t);
|
|
59823
59827
|
}
|
|
@@ -59837,7 +59841,7 @@ function createTypeChecker(host) {
|
|
|
59837
59841
|
const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1;
|
|
59838
59842
|
const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
|
|
59839
59843
|
const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
|
|
59840
|
-
links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol)
|
|
59844
|
+
links.resolvedType = getIntersectionType(types, noSupertypeReduction ? 1 /* NoSupertypeReduction */ : 0, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
|
|
59841
59845
|
}
|
|
59842
59846
|
return links.resolvedType;
|
|
59843
59847
|
}
|
|
@@ -60528,7 +60532,7 @@ function createTypeChecker(host) {
|
|
|
60528
60532
|
if (wasMissingProp) {
|
|
60529
60533
|
return void 0;
|
|
60530
60534
|
}
|
|
60531
|
-
return accessFlags & 4 /* Writing */ ? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
60535
|
+
return accessFlags & 4 /* Writing */ ? getIntersectionType(propTypes, 0 /* None */, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
60532
60536
|
}
|
|
60533
60537
|
return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags | 8 /* CacheSymbol */ | 64 /* ReportDeprecated */);
|
|
60534
60538
|
}
|
|
@@ -61652,7 +61656,7 @@ function createTypeChecker(host) {
|
|
|
61652
61656
|
}
|
|
61653
61657
|
const newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
61654
61658
|
const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
61655
|
-
return flags & 2097152 /* Intersection */ || origin && origin.flags & 2097152 /* Intersection */ ? getIntersectionType(newTypes, newAliasSymbol, newAliasTypeArguments) : getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments);
|
|
61659
|
+
return flags & 2097152 /* Intersection */ || origin && origin.flags & 2097152 /* Intersection */ ? getIntersectionType(newTypes, 0 /* None */, newAliasSymbol, newAliasTypeArguments) : getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments);
|
|
61656
61660
|
}
|
|
61657
61661
|
if (flags & 4194304 /* Index */) {
|
|
61658
61662
|
return getIndexType(instantiateType(type.type, mapper));
|
|
@@ -69003,7 +69007,7 @@ function createTypeChecker(host) {
|
|
|
69003
69007
|
if (!hasDefaultClause) {
|
|
69004
69008
|
return caseType;
|
|
69005
69009
|
}
|
|
69006
|
-
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
69010
|
+
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 32768 /* Undefined */ ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
69007
69011
|
return caseType.flags & 131072 /* Never */ ? defaultType : getUnionType([caseType, defaultType]);
|
|
69008
69012
|
}
|
|
69009
69013
|
function narrowTypeByTypeName(type, typeName) {
|
|
@@ -119019,6 +119023,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119019
119023
|
const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
119020
119024
|
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion2 } = createProgramOptions;
|
|
119021
119025
|
let { oldProgram } = createProgramOptions;
|
|
119026
|
+
for (const option of commandLineOptionOfCustomType) {
|
|
119027
|
+
if (hasProperty(options, option.name)) {
|
|
119028
|
+
if (typeof options[option.name] === "string") {
|
|
119029
|
+
throw new Error(`${option.name} is a string value; tsconfig JSON must be parsed with parseJsonSourceFileConfigFileContent or getParsedCommandLineOfConfigFile before passing to createProgram`);
|
|
119030
|
+
}
|
|
119031
|
+
}
|
|
119032
|
+
}
|
|
119022
119033
|
const reportInvalidIgnoreDeprecations = memoize(() => createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations));
|
|
119023
119034
|
let processingDefaultLibFiles;
|
|
119024
119035
|
let processingOtherFiles;
|
package/lib/typescript.js
CHANGED
|
@@ -99,6 +99,7 @@ __export(typescript_exports, {
|
|
|
99
99
|
InlayHints: () => ts_InlayHints_exports,
|
|
100
100
|
InternalEmitFlags: () => InternalEmitFlags,
|
|
101
101
|
InternalSymbolName: () => InternalSymbolName,
|
|
102
|
+
IntersectionFlags: () => IntersectionFlags,
|
|
102
103
|
InvalidatedProjectKind: () => InvalidatedProjectKind,
|
|
103
104
|
JSDocParsingMode: () => JSDocParsingMode,
|
|
104
105
|
JsDoc: () => ts_JsDoc_exports,
|
|
@@ -302,6 +303,7 @@ __export(typescript_exports, {
|
|
|
302
303
|
collectExternalModuleInfo: () => collectExternalModuleInfo,
|
|
303
304
|
combine: () => combine,
|
|
304
305
|
combinePaths: () => combinePaths,
|
|
306
|
+
commandLineOptionOfCustomType: () => commandLineOptionOfCustomType,
|
|
305
307
|
commentPragmas: () => commentPragmas,
|
|
306
308
|
commonOptionsWithBuild: () => commonOptionsWithBuild,
|
|
307
309
|
commonPackageFolders: () => commonPackageFolders,
|
|
@@ -2362,7 +2364,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2362
2364
|
|
|
2363
2365
|
// src/compiler/corePublic.ts
|
|
2364
2366
|
var versionMajorMinor = "5.5";
|
|
2365
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2367
|
+
var version = `${versionMajorMinor}.0-dev.20240503`;
|
|
2366
2368
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2367
2369
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2368
2370
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6389,6 +6391,12 @@ var UnionReduction = /* @__PURE__ */ ((UnionReduction2) => {
|
|
|
6389
6391
|
UnionReduction2[UnionReduction2["Subtype"] = 2] = "Subtype";
|
|
6390
6392
|
return UnionReduction2;
|
|
6391
6393
|
})(UnionReduction || {});
|
|
6394
|
+
var IntersectionFlags = /* @__PURE__ */ ((IntersectionFlags2) => {
|
|
6395
|
+
IntersectionFlags2[IntersectionFlags2["None"] = 0] = "None";
|
|
6396
|
+
IntersectionFlags2[IntersectionFlags2["NoSupertypeReduction"] = 1] = "NoSupertypeReduction";
|
|
6397
|
+
IntersectionFlags2[IntersectionFlags2["NoConstraintReduction"] = 2] = "NoConstraintReduction";
|
|
6398
|
+
return IntersectionFlags2;
|
|
6399
|
+
})(IntersectionFlags || {});
|
|
6392
6400
|
var ContextFlags = /* @__PURE__ */ ((ContextFlags3) => {
|
|
6393
6401
|
ContextFlags3[ContextFlags3["None"] = 0] = "None";
|
|
6394
6402
|
ContextFlags3[ContextFlags3["Signature"] = 1] = "Signature";
|
|
@@ -17460,7 +17468,7 @@ function entityNameToString(name) {
|
|
|
17460
17468
|
return Debug.assertNever(name.name);
|
|
17461
17469
|
}
|
|
17462
17470
|
case 311 /* JSDocMemberName */:
|
|
17463
|
-
return entityNameToString(name.left) + entityNameToString(name.right);
|
|
17471
|
+
return entityNameToString(name.left) + "#" + entityNameToString(name.right);
|
|
17464
17472
|
case 295 /* JsxNamespacedName */:
|
|
17465
17473
|
return entityNameToString(name.namespace) + ":" + entityNameToString(name.name);
|
|
17466
17474
|
default:
|
|
@@ -41444,6 +41452,10 @@ var configDirTemplateSubstitutionOptions = optionDeclarations.filter(
|
|
|
41444
41452
|
var configDirTemplateSubstitutionWatchOptions = optionsForWatch.filter(
|
|
41445
41453
|
(option) => option.allowConfigDirTemplateSubstitution || !option.isCommandLineOnly && option.isFilePath
|
|
41446
41454
|
);
|
|
41455
|
+
var commandLineOptionOfCustomType = optionDeclarations.filter(isCommandLineOptionOfCustomType);
|
|
41456
|
+
function isCommandLineOptionOfCustomType(option) {
|
|
41457
|
+
return !isString(option.type);
|
|
41458
|
+
}
|
|
41447
41459
|
var optionsForBuild = [
|
|
41448
41460
|
{
|
|
41449
41461
|
name: "verbose",
|
|
@@ -61734,7 +61746,7 @@ function createTypeChecker(host) {
|
|
|
61734
61746
|
}
|
|
61735
61747
|
}
|
|
61736
61748
|
return getNormalizedType(
|
|
61737
|
-
getIntersectionType(constraints),
|
|
61749
|
+
getIntersectionType(constraints, 2 /* NoConstraintReduction */),
|
|
61738
61750
|
/*writing*/
|
|
61739
61751
|
false
|
|
61740
61752
|
);
|
|
@@ -64539,7 +64551,7 @@ function createTypeChecker(host) {
|
|
|
64539
64551
|
result.aliasTypeArguments = aliasTypeArguments;
|
|
64540
64552
|
return result;
|
|
64541
64553
|
}
|
|
64542
|
-
function getIntersectionType(types, aliasSymbol, aliasTypeArguments
|
|
64554
|
+
function getIntersectionType(types, flags = 0 /* None */, aliasSymbol, aliasTypeArguments) {
|
|
64543
64555
|
const typeMembershipMap = /* @__PURE__ */ new Map();
|
|
64544
64556
|
const includes = addTypesToIntersection(typeMembershipMap, 0, types);
|
|
64545
64557
|
const typeSet = arrayFrom(typeMembershipMap.values());
|
|
@@ -64560,7 +64572,7 @@ function createTypeChecker(host) {
|
|
|
64560
64572
|
return includes & 16777216 /* IncludesEmptyObject */ ? neverType : includes & 32768 /* Undefined */ ? undefinedType : nullType;
|
|
64561
64573
|
}
|
|
64562
64574
|
if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ || includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ || includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ || includes & 16384 /* Void */ && includes & 32768 /* Undefined */ || includes & 16777216 /* IncludesEmptyObject */ && includes & 470302716 /* DefinitelyNonNullable */) {
|
|
64563
|
-
if (!
|
|
64575
|
+
if (!(flags & 1 /* NoSupertypeReduction */))
|
|
64564
64576
|
removeRedundantSupertypes(typeSet, includes);
|
|
64565
64577
|
}
|
|
64566
64578
|
if (includes & 262144 /* IncludesMissingType */) {
|
|
@@ -64572,7 +64584,7 @@ function createTypeChecker(host) {
|
|
|
64572
64584
|
if (typeSet.length === 1) {
|
|
64573
64585
|
return typeSet[0];
|
|
64574
64586
|
}
|
|
64575
|
-
if (typeSet.length === 2) {
|
|
64587
|
+
if (typeSet.length === 2 && !(flags & 2 /* NoConstraintReduction */)) {
|
|
64576
64588
|
const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
64577
64589
|
const typeVariable = typeSet[typeVarIndex];
|
|
64578
64590
|
const primitiveType = typeSet[1 - typeVarIndex];
|
|
@@ -64591,27 +64603,27 @@ function createTypeChecker(host) {
|
|
|
64591
64603
|
}
|
|
64592
64604
|
}
|
|
64593
64605
|
}
|
|
64594
|
-
const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
64606
|
+
const id = getTypeListId(typeSet) + (flags & 2 /* NoConstraintReduction */ ? "*" : getAliasId(aliasSymbol, aliasTypeArguments));
|
|
64595
64607
|
let result = intersectionTypes.get(id);
|
|
64596
64608
|
if (!result) {
|
|
64597
64609
|
if (includes & 1048576 /* Union */) {
|
|
64598
64610
|
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
|
|
64599
|
-
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
64611
|
+
result = getIntersectionType(typeSet, flags, aliasSymbol, aliasTypeArguments);
|
|
64600
64612
|
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && t.types[0].flags & 32768 /* Undefined */))) {
|
|
64601
64613
|
const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType;
|
|
64602
64614
|
removeFromEach(typeSet, 32768 /* Undefined */);
|
|
64603
|
-
result = getUnionType([getIntersectionType(typeSet), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
64615
|
+
result = getUnionType([getIntersectionType(typeSet, flags), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
64604
64616
|
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
|
|
64605
64617
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
64606
|
-
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
64618
|
+
result = getUnionType([getIntersectionType(typeSet, flags), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
64607
64619
|
} else if (typeSet.length >= 4) {
|
|
64608
64620
|
const middle = Math.floor(typeSet.length / 2);
|
|
64609
|
-
result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle)), getIntersectionType(typeSet.slice(middle))], aliasSymbol, aliasTypeArguments);
|
|
64621
|
+
result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle), flags), getIntersectionType(typeSet.slice(middle), flags)], flags, aliasSymbol, aliasTypeArguments);
|
|
64610
64622
|
} else {
|
|
64611
64623
|
if (!checkCrossProductUnion(typeSet)) {
|
|
64612
64624
|
return errorType;
|
|
64613
64625
|
}
|
|
64614
|
-
const constituents = getCrossProductIntersections(typeSet);
|
|
64626
|
+
const constituents = getCrossProductIntersections(typeSet, flags);
|
|
64615
64627
|
const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : void 0;
|
|
64616
64628
|
result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
|
|
64617
64629
|
}
|
|
@@ -64635,7 +64647,7 @@ function createTypeChecker(host) {
|
|
|
64635
64647
|
}
|
|
64636
64648
|
return true;
|
|
64637
64649
|
}
|
|
64638
|
-
function getCrossProductIntersections(types) {
|
|
64650
|
+
function getCrossProductIntersections(types, flags) {
|
|
64639
64651
|
const count = getCrossProductUnionSize(types);
|
|
64640
64652
|
const intersections = [];
|
|
64641
64653
|
for (let i = 0; i < count; i++) {
|
|
@@ -64649,7 +64661,7 @@ function createTypeChecker(host) {
|
|
|
64649
64661
|
n = Math.floor(n / length2);
|
|
64650
64662
|
}
|
|
64651
64663
|
}
|
|
64652
|
-
const t = getIntersectionType(constituents);
|
|
64664
|
+
const t = getIntersectionType(constituents, flags);
|
|
64653
64665
|
if (!(t.flags & 131072 /* Never */))
|
|
64654
64666
|
intersections.push(t);
|
|
64655
64667
|
}
|
|
@@ -64669,7 +64681,7 @@ function createTypeChecker(host) {
|
|
|
64669
64681
|
const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1;
|
|
64670
64682
|
const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
|
|
64671
64683
|
const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
|
|
64672
|
-
links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol)
|
|
64684
|
+
links.resolvedType = getIntersectionType(types, noSupertypeReduction ? 1 /* NoSupertypeReduction */ : 0, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
|
|
64673
64685
|
}
|
|
64674
64686
|
return links.resolvedType;
|
|
64675
64687
|
}
|
|
@@ -65360,7 +65372,7 @@ function createTypeChecker(host) {
|
|
|
65360
65372
|
if (wasMissingProp) {
|
|
65361
65373
|
return void 0;
|
|
65362
65374
|
}
|
|
65363
|
-
return accessFlags & 4 /* Writing */ ? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
65375
|
+
return accessFlags & 4 /* Writing */ ? getIntersectionType(propTypes, 0 /* None */, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
65364
65376
|
}
|
|
65365
65377
|
return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags | 8 /* CacheSymbol */ | 64 /* ReportDeprecated */);
|
|
65366
65378
|
}
|
|
@@ -66484,7 +66496,7 @@ function createTypeChecker(host) {
|
|
|
66484
66496
|
}
|
|
66485
66497
|
const newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
66486
66498
|
const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
66487
|
-
return flags & 2097152 /* Intersection */ || origin && origin.flags & 2097152 /* Intersection */ ? getIntersectionType(newTypes, newAliasSymbol, newAliasTypeArguments) : getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments);
|
|
66499
|
+
return flags & 2097152 /* Intersection */ || origin && origin.flags & 2097152 /* Intersection */ ? getIntersectionType(newTypes, 0 /* None */, newAliasSymbol, newAliasTypeArguments) : getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments);
|
|
66488
66500
|
}
|
|
66489
66501
|
if (flags & 4194304 /* Index */) {
|
|
66490
66502
|
return getIndexType(instantiateType(type.type, mapper));
|
|
@@ -73835,7 +73847,7 @@ function createTypeChecker(host) {
|
|
|
73835
73847
|
if (!hasDefaultClause) {
|
|
73836
73848
|
return caseType;
|
|
73837
73849
|
}
|
|
73838
|
-
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
73850
|
+
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 32768 /* Undefined */ ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
73839
73851
|
return caseType.flags & 131072 /* Never */ ? defaultType : getUnionType([caseType, defaultType]);
|
|
73840
73852
|
}
|
|
73841
73853
|
function narrowTypeByTypeName(type, typeName) {
|
|
@@ -124095,6 +124107,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124095
124107
|
const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
124096
124108
|
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } = createProgramOptions;
|
|
124097
124109
|
let { oldProgram } = createProgramOptions;
|
|
124110
|
+
for (const option of commandLineOptionOfCustomType) {
|
|
124111
|
+
if (hasProperty(options, option.name)) {
|
|
124112
|
+
if (typeof options[option.name] === "string") {
|
|
124113
|
+
throw new Error(`${option.name} is a string value; tsconfig JSON must be parsed with parseJsonSourceFileConfigFileContent or getParsedCommandLineOfConfigFile before passing to createProgram`);
|
|
124114
|
+
}
|
|
124115
|
+
}
|
|
124116
|
+
}
|
|
124098
124117
|
const reportInvalidIgnoreDeprecations = memoize(() => createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations));
|
|
124099
124118
|
let processingDefaultLibFiles;
|
|
124100
124119
|
let processingOtherFiles;
|
|
@@ -178877,6 +178896,7 @@ __export(ts_exports2, {
|
|
|
178877
178896
|
InlayHints: () => ts_InlayHints_exports,
|
|
178878
178897
|
InternalEmitFlags: () => InternalEmitFlags,
|
|
178879
178898
|
InternalSymbolName: () => InternalSymbolName,
|
|
178899
|
+
IntersectionFlags: () => IntersectionFlags,
|
|
178880
178900
|
InvalidatedProjectKind: () => InvalidatedProjectKind,
|
|
178881
178901
|
JSDocParsingMode: () => JSDocParsingMode,
|
|
178882
178902
|
JsDoc: () => ts_JsDoc_exports,
|
|
@@ -179080,6 +179100,7 @@ __export(ts_exports2, {
|
|
|
179080
179100
|
collectExternalModuleInfo: () => collectExternalModuleInfo,
|
|
179081
179101
|
combine: () => combine,
|
|
179082
179102
|
combinePaths: () => combinePaths,
|
|
179103
|
+
commandLineOptionOfCustomType: () => commandLineOptionOfCustomType,
|
|
179083
179104
|
commentPragmas: () => commentPragmas,
|
|
179084
179105
|
commonOptionsWithBuild: () => commonOptionsWithBuild,
|
|
179085
179106
|
commonPackageFolders: () => commonPackageFolders,
|
|
@@ -193305,6 +193326,7 @@ if (typeof console !== "undefined") {
|
|
|
193305
193326
|
InlayHints,
|
|
193306
193327
|
InternalEmitFlags,
|
|
193307
193328
|
InternalSymbolName,
|
|
193329
|
+
IntersectionFlags,
|
|
193308
193330
|
InvalidatedProjectKind,
|
|
193309
193331
|
JSDocParsingMode,
|
|
193310
193332
|
JsDoc,
|
|
@@ -193508,6 +193530,7 @@ if (typeof console !== "undefined") {
|
|
|
193508
193530
|
collectExternalModuleInfo,
|
|
193509
193531
|
combine,
|
|
193510
193532
|
combinePaths,
|
|
193533
|
+
commandLineOptionOfCustomType,
|
|
193511
193534
|
commentPragmas,
|
|
193512
193535
|
commonOptionsWithBuild,
|
|
193513
193536
|
commonPackageFolders,
|
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.5.0-dev.
|
|
5
|
+
"version": "5.5.0-dev.20240503",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"node": "20.1.0",
|
|
111
111
|
"npm": "8.19.4"
|
|
112
112
|
},
|
|
113
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "3a74ec4e992eacba932c302fded9a636a6c00875"
|
|
114
114
|
}
|