typescript 5.9.0-dev.20250630 → 5.9.0-dev.20250701
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 +137 -50
- package/lib/typescript.js +197 -76
- 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.9";
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20250701`;
|
22
22
|
|
23
23
|
// src/compiler/core.ts
|
24
24
|
var emptyArray = [];
|
@@ -6686,7 +6686,7 @@ var Diagnostics = {
|
|
6686
6686
|
Cannot_invoke_an_object_which_is_possibly_undefined: diag(2722, 1 /* Error */, "Cannot_invoke_an_object_which_is_possibly_undefined_2722", "Cannot invoke an object which is possibly 'undefined'."),
|
6687
6687
|
Cannot_invoke_an_object_which_is_possibly_null_or_undefined: diag(2723, 1 /* Error */, "Cannot_invoke_an_object_which_is_possibly_null_or_undefined_2723", "Cannot invoke an object which is possibly 'null' or 'undefined'."),
|
6688
6688
|
_0_has_no_exported_member_named_1_Did_you_mean_2: diag(2724, 1 /* Error */, "_0_has_no_exported_member_named_1_Did_you_mean_2_2724", "'{0}' has no exported member named '{1}'. Did you mean '{2}'?"),
|
6689
|
-
|
6689
|
+
Class_name_cannot_be_Object_when_targeting_ES5_and_above_with_module_0: diag(2725, 1 /* Error */, "Class_name_cannot_be_Object_when_targeting_ES5_and_above_with_module_0_2725", "Class name cannot be 'Object' when targeting ES5 and above with module {0}."),
|
6690
6690
|
Cannot_find_lib_definition_for_0: diag(2726, 1 /* Error */, "Cannot_find_lib_definition_for_0_2726", "Cannot find lib definition for '{0}'."),
|
6691
6691
|
Cannot_find_lib_definition_for_0_Did_you_mean_1: diag(2727, 1 /* Error */, "Cannot_find_lib_definition_for_0_Did_you_mean_1_2727", "Cannot find lib definition for '{0}'. Did you mean '{1}'?"),
|
6692
6692
|
_0_is_declared_here: diag(2728, 3 /* Message */, "_0_is_declared_here_2728", "'{0}' is declared here."),
|
@@ -16081,7 +16081,7 @@ function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
|
|
16081
16081
|
function getBinaryOperatorPrecedence(kind) {
|
16082
16082
|
switch (kind) {
|
16083
16083
|
case 61 /* QuestionQuestionToken */:
|
16084
|
-
return
|
16084
|
+
return 5 /* Coalesce */;
|
16085
16085
|
case 57 /* BarBarToken */:
|
16086
16086
|
return 5 /* LogicalOR */;
|
16087
16087
|
case 56 /* AmpersandAmpersandToken */:
|
@@ -18334,7 +18334,7 @@ function isNodeModulesOrScopedPackageDirectory(s, getCanonicalFileName) {
|
|
18334
18334
|
var reservedCharacterPattern = /[^\w\s/]/g;
|
18335
18335
|
var wildcardCharCodes = [42 /* asterisk */, 63 /* question */];
|
18336
18336
|
var commonPackageFolders = ["node_modules", "bower_components", "jspm_packages"];
|
18337
|
-
var implicitExcludePathRegexPattern = `(?!(
|
18337
|
+
var implicitExcludePathRegexPattern = `(?!(?:${commonPackageFolders.join("|")})(?:/|$))`;
|
18338
18338
|
var filesMatcher = {
|
18339
18339
|
/**
|
18340
18340
|
* Matches any single directory segment unless it is the last segment and a .min.js file
|
@@ -18342,12 +18342,12 @@ var filesMatcher = {
|
|
18342
18342
|
* [^./] # matches everything up to the first . character (excluding directory separators)
|
18343
18343
|
* (\\.(?!min\\.js$))? # matches . characters but not if they are part of the .min.js file extension
|
18344
18344
|
*/
|
18345
|
-
singleAsteriskRegexFragment: "([^./]|(
|
18345
|
+
singleAsteriskRegexFragment: "(?:[^./]|(?:\\.(?!min\\.js$))?)*",
|
18346
18346
|
/**
|
18347
18347
|
* Regex for the ** wildcard. Matches any number of subdirectories. When used for including
|
18348
18348
|
* files or directories, does not match subdirectories that start with a . character
|
18349
18349
|
*/
|
18350
|
-
doubleAsteriskRegexFragment: `(
|
18350
|
+
doubleAsteriskRegexFragment: `(?:/${implicitExcludePathRegexPattern}[^/.][^/]*)*?`,
|
18351
18351
|
replaceWildcardCharacter: (match) => replaceWildcardCharacter(match, filesMatcher.singleAsteriskRegexFragment)
|
18352
18352
|
};
|
18353
18353
|
var directoriesMatcher = {
|
@@ -18356,12 +18356,12 @@ var directoriesMatcher = {
|
|
18356
18356
|
* Regex for the ** wildcard. Matches any number of subdirectories. When used for including
|
18357
18357
|
* files or directories, does not match subdirectories that start with a . character
|
18358
18358
|
*/
|
18359
|
-
doubleAsteriskRegexFragment: `(
|
18359
|
+
doubleAsteriskRegexFragment: `(?:/${implicitExcludePathRegexPattern}[^/.][^/]*)*?`,
|
18360
18360
|
replaceWildcardCharacter: (match) => replaceWildcardCharacter(match, directoriesMatcher.singleAsteriskRegexFragment)
|
18361
18361
|
};
|
18362
18362
|
var excludeMatcher = {
|
18363
18363
|
singleAsteriskRegexFragment: "[^/]*",
|
18364
|
-
doubleAsteriskRegexFragment: "(
|
18364
|
+
doubleAsteriskRegexFragment: "(?:/.+?)?",
|
18365
18365
|
replaceWildcardCharacter: (match) => replaceWildcardCharacter(match, excludeMatcher.singleAsteriskRegexFragment)
|
18366
18366
|
};
|
18367
18367
|
var wildcardMatchers = {
|
@@ -18374,9 +18374,9 @@ function getRegularExpressionForWildcard(specs, basePath, usage) {
|
|
18374
18374
|
if (!patterns || !patterns.length) {
|
18375
18375
|
return void 0;
|
18376
18376
|
}
|
18377
|
-
const pattern = patterns.map((pattern2) => `(
|
18378
|
-
const terminator = usage === "exclude" ? "(
|
18379
|
-
return `^(
|
18377
|
+
const pattern = patterns.map((pattern2) => `(?:${pattern2})`).join("|");
|
18378
|
+
const terminator = usage === "exclude" ? "(?:$|/)" : "$";
|
18379
|
+
return `^(?:${pattern})${terminator}`;
|
18380
18380
|
}
|
18381
18381
|
function getRegularExpressionsForWildcards(specs, basePath, usage) {
|
18382
18382
|
if (specs === void 0 || specs.length === 0) {
|
@@ -18389,7 +18389,7 @@ function isImplicitGlob(lastPathComponent) {
|
|
18389
18389
|
}
|
18390
18390
|
function getPatternFromSpec(spec, basePath, usage) {
|
18391
18391
|
const pattern = spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]);
|
18392
|
-
return pattern && `^(
|
18392
|
+
return pattern && `^(?:${pattern})${usage === "exclude" ? "(?:$|/)" : "$"}`;
|
18393
18393
|
}
|
18394
18394
|
function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter: replaceWildcardCharacter2 } = wildcardMatchers[usage]) {
|
18395
18395
|
let subpattern = "";
|
@@ -18409,7 +18409,7 @@ function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragm
|
|
18409
18409
|
subpattern += doubleAsteriskRegexFragment;
|
18410
18410
|
} else {
|
18411
18411
|
if (usage === "directories") {
|
18412
|
-
subpattern += "(";
|
18412
|
+
subpattern += "(?:";
|
18413
18413
|
optionalCount++;
|
18414
18414
|
}
|
18415
18415
|
if (hasWrittenComponent) {
|
@@ -18418,7 +18418,7 @@ function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragm
|
|
18418
18418
|
if (usage !== "exclude") {
|
18419
18419
|
let componentPattern = "";
|
18420
18420
|
if (component.charCodeAt(0) === 42 /* asterisk */) {
|
18421
|
-
componentPattern += "([^./]" + singleAsteriskRegexFragment + ")?";
|
18421
|
+
componentPattern += "(?:[^./]" + singleAsteriskRegexFragment + ")?";
|
18422
18422
|
component = component.substr(1);
|
18423
18423
|
} else if (component.charCodeAt(0) === 63 /* question */) {
|
18424
18424
|
componentPattern += "[^./]";
|
@@ -31976,10 +31976,13 @@ var Parser;
|
|
31976
31976
|
if (token() !== 27 /* SemicolonToken */ && token() !== 100 /* FunctionKeyword */ && token() !== 86 /* ClassKeyword */ && isStartOfStatement() && !isStartOfExpressionStatement()) {
|
31977
31977
|
return parseFunctionBlock(16 /* IgnoreMissingOpenBrace */ | (isAsync ? 2 /* Await */ : 0 /* None */));
|
31978
31978
|
}
|
31979
|
+
const savedYieldContext = inYieldContext();
|
31980
|
+
setYieldContext(false);
|
31979
31981
|
const savedTopLevel = topLevel;
|
31980
31982
|
topLevel = false;
|
31981
31983
|
const node = isAsync ? doInAwaitContext(() => parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction)) : doOutsideOfAwaitContext(() => parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction));
|
31982
31984
|
topLevel = savedTopLevel;
|
31985
|
+
setYieldContext(savedYieldContext);
|
31983
31986
|
return node;
|
31984
31987
|
}
|
31985
31988
|
function parseConditionalExpressionRest(leftOperand, pos, allowReturnTypeInArrowFunction) {
|
@@ -47224,6 +47227,7 @@ function createTypeChecker(host) {
|
|
47224
47227
|
}
|
47225
47228
|
};
|
47226
47229
|
var anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
|
47230
|
+
var silentNeverIterationTypes = createIterationTypes(silentNeverType, silentNeverType, silentNeverType);
|
47227
47231
|
var asyncIterationTypesResolver = {
|
47228
47232
|
iterableCacheKey: "iterationTypesOfAsyncIterable",
|
47229
47233
|
iteratorCacheKey: "iterationTypesOfAsyncIterator",
|
@@ -50437,7 +50441,14 @@ function createTypeChecker(host) {
|
|
50437
50441
|
if (symbol.flags & 2097152 /* Alias */ && isInJSFile(declaration) && ((_a = declaration.parent) == null ? void 0 : _a.parent) && isVariableDeclaration(declaration.parent.parent) && ((_b = declaration.parent.parent.parent) == null ? void 0 : _b.parent) && isVariableStatement(declaration.parent.parent.parent.parent) && !hasSyntacticModifier(declaration.parent.parent.parent.parent, 32 /* Export */) && declaration.parent.parent.parent.parent.parent && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) {
|
50438
50442
|
return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
|
50439
50443
|
} else if (symbol.flags & 2 /* BlockScopedVariable */) {
|
50440
|
-
const
|
50444
|
+
const rootDeclaration = walkUpBindingElementsAndPatterns(declaration);
|
50445
|
+
if (rootDeclaration.kind === 170 /* Parameter */) {
|
50446
|
+
return false;
|
50447
|
+
}
|
50448
|
+
const variableStatement = rootDeclaration.parent.parent;
|
50449
|
+
if (variableStatement.kind !== 244 /* VariableStatement */) {
|
50450
|
+
return false;
|
50451
|
+
}
|
50441
50452
|
if (hasSyntacticModifier(variableStatement, 32 /* Export */)) {
|
50442
50453
|
return true;
|
50443
50454
|
}
|
@@ -52131,27 +52142,77 @@ function createTypeChecker(host) {
|
|
52131
52142
|
context.approximateLength += symbolName(propertySymbol).length + 1;
|
52132
52143
|
if (propertySymbol.flags & 98304 /* Accessor */) {
|
52133
52144
|
const writeType = getWriteTypeOfSymbol(propertySymbol);
|
52134
|
-
if (
|
52145
|
+
if (!isErrorType(propertyType) && !isErrorType(writeType)) {
|
52135
52146
|
const symbolMapper = getSymbolLinks(propertySymbol).mapper;
|
52136
|
-
const
|
52137
|
-
|
52138
|
-
|
52139
|
-
|
52140
|
-
|
52141
|
-
|
52142
|
-
|
52143
|
-
|
52144
|
-
|
52145
|
-
|
52146
|
-
|
52147
|
-
|
52148
|
-
|
52149
|
-
|
52150
|
-
|
52151
|
-
setterDeclaration
|
52152
|
-
|
52153
|
-
|
52154
|
-
|
52147
|
+
const propDeclaration = getDeclarationOfKind(propertySymbol, 173 /* PropertyDeclaration */);
|
52148
|
+
if (propertyType !== writeType || propertySymbol.parent.flags & 32 /* Class */ && !propDeclaration) {
|
52149
|
+
const getterDeclaration = getDeclarationOfKind(propertySymbol, 178 /* GetAccessor */);
|
52150
|
+
if (getterDeclaration) {
|
52151
|
+
const getterSignature = getSignatureFromDeclaration(getterDeclaration);
|
52152
|
+
typeElements.push(
|
52153
|
+
setCommentRange2(
|
52154
|
+
context,
|
52155
|
+
signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(getterSignature, symbolMapper) : getterSignature, 178 /* GetAccessor */, context, { name: propertyName }),
|
52156
|
+
getterDeclaration
|
52157
|
+
)
|
52158
|
+
);
|
52159
|
+
}
|
52160
|
+
const setterDeclaration = getDeclarationOfKind(propertySymbol, 179 /* SetAccessor */);
|
52161
|
+
if (setterDeclaration) {
|
52162
|
+
const setterSignature = getSignatureFromDeclaration(setterDeclaration);
|
52163
|
+
typeElements.push(
|
52164
|
+
setCommentRange2(
|
52165
|
+
context,
|
52166
|
+
signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(setterSignature, symbolMapper) : setterSignature, 179 /* SetAccessor */, context, { name: propertyName }),
|
52167
|
+
setterDeclaration
|
52168
|
+
)
|
52169
|
+
);
|
52170
|
+
}
|
52171
|
+
return;
|
52172
|
+
}
|
52173
|
+
if (propertySymbol.parent.flags & 32 /* Class */ && propDeclaration && find(propDeclaration.modifiers, isAccessorModifier)) {
|
52174
|
+
const fakeGetterSignature = createSignature(
|
52175
|
+
/*declaration*/
|
52176
|
+
void 0,
|
52177
|
+
/*typeParameters*/
|
52178
|
+
void 0,
|
52179
|
+
/*thisParameter*/
|
52180
|
+
void 0,
|
52181
|
+
emptyArray,
|
52182
|
+
propertyType,
|
52183
|
+
/*resolvedTypePredicate*/
|
52184
|
+
void 0,
|
52185
|
+
0,
|
52186
|
+
0 /* None */
|
52187
|
+
);
|
52188
|
+
typeElements.push(
|
52189
|
+
setCommentRange2(
|
52190
|
+
context,
|
52191
|
+
signatureToSignatureDeclarationHelper(fakeGetterSignature, 178 /* GetAccessor */, context, { name: propertyName }),
|
52192
|
+
propDeclaration
|
52193
|
+
)
|
52194
|
+
);
|
52195
|
+
const setterParam = createSymbol(1 /* FunctionScopedVariable */, "arg");
|
52196
|
+
setterParam.links.type = writeType;
|
52197
|
+
const fakeSetterSignature = createSignature(
|
52198
|
+
/*declaration*/
|
52199
|
+
void 0,
|
52200
|
+
/*typeParameters*/
|
52201
|
+
void 0,
|
52202
|
+
/*thisParameter*/
|
52203
|
+
void 0,
|
52204
|
+
[setterParam],
|
52205
|
+
voidType,
|
52206
|
+
/*resolvedTypePredicate*/
|
52207
|
+
void 0,
|
52208
|
+
0,
|
52209
|
+
0 /* None */
|
52210
|
+
);
|
52211
|
+
typeElements.push(
|
52212
|
+
signatureToSignatureDeclarationHelper(fakeSetterSignature, 179 /* SetAccessor */, context, { name: propertyName })
|
52213
|
+
);
|
52214
|
+
return;
|
52215
|
+
}
|
52155
52216
|
}
|
52156
52217
|
}
|
52157
52218
|
const optionalToken = propertySymbol.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0;
|
@@ -56742,11 +56803,14 @@ function createTypeChecker(host) {
|
|
56742
56803
|
}
|
56743
56804
|
function getWriteTypeOfSymbol(symbol) {
|
56744
56805
|
const checkFlags = getCheckFlags(symbol);
|
56745
|
-
if (
|
56746
|
-
return checkFlags &
|
56806
|
+
if (checkFlags & 2 /* SyntheticProperty */) {
|
56807
|
+
return checkFlags & 65536 /* DeferredType */ ? getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) : (
|
56747
56808
|
// NOTE: cast to TransientSymbol should be safe because only TransientSymbols can have CheckFlags.SyntheticProperty
|
56748
56809
|
symbol.links.writeType || symbol.links.type
|
56749
|
-
)
|
56810
|
+
);
|
56811
|
+
}
|
56812
|
+
if (symbol.flags & 4 /* Property */) {
|
56813
|
+
return removeMissingType(getTypeOfSymbol(symbol), !!(symbol.flags & 16777216 /* Optional */));
|
56750
56814
|
}
|
56751
56815
|
if (symbol.flags & 98304 /* Accessor */) {
|
56752
56816
|
return checkFlags & 1 /* Instantiated */ ? getWriteTypeOfInstantiatedSymbol(symbol) : getWriteTypeOfAccessors(symbol);
|
@@ -58902,6 +58966,7 @@ function createTypeChecker(host) {
|
|
58902
58966
|
}
|
58903
58967
|
function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) {
|
58904
58968
|
var _a, _b, _c;
|
58969
|
+
let propFlags = 0 /* None */;
|
58905
58970
|
let singleProp;
|
58906
58971
|
let propSet;
|
58907
58972
|
let indexTypes;
|
@@ -58926,6 +58991,7 @@ function createTypeChecker(host) {
|
|
58926
58991
|
}
|
58927
58992
|
if (!singleProp) {
|
58928
58993
|
singleProp = prop;
|
58994
|
+
propFlags = prop.flags & 98304 /* Accessor */ || 4 /* Property */;
|
58929
58995
|
} else if (prop !== singleProp) {
|
58930
58996
|
const isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp);
|
58931
58997
|
if (isInstantiation && compareProperties(singleProp, prop, (a, b) => a === b ? -1 /* True */ : 0 /* False */) === -1 /* True */) {
|
@@ -58940,6 +59006,9 @@ function createTypeChecker(host) {
|
|
58940
59006
|
propSet.set(id, prop);
|
58941
59007
|
}
|
58942
59008
|
}
|
59009
|
+
if (propFlags & 98304 /* Accessor */ && (prop.flags & 98304 /* Accessor */) !== (propFlags & 98304 /* Accessor */)) {
|
59010
|
+
propFlags = propFlags & ~98304 /* Accessor */ | 4 /* Property */;
|
59011
|
+
}
|
58943
59012
|
}
|
58944
59013
|
if (isUnion && isReadonlySymbol(prop)) {
|
58945
59014
|
checkFlags |= 8 /* Readonly */;
|
@@ -58953,6 +59022,7 @@ function createTypeChecker(host) {
|
|
58953
59022
|
} else if (isUnion) {
|
58954
59023
|
const indexInfo = !isLateBoundName(name) && getApplicableIndexInfoForName(type, name);
|
58955
59024
|
if (indexInfo) {
|
59025
|
+
propFlags = propFlags & ~98304 /* Accessor */ | 4 /* Property */;
|
58956
59026
|
checkFlags |= 32 /* WritePartial */ | (indexInfo.isReadonly ? 8 /* Readonly */ : 0);
|
58957
59027
|
indexTypes = append(indexTypes, isTupleType(type) ? getRestTypeOfTupleType(type) || undefinedType : indexInfo.type);
|
58958
59028
|
} else if (isObjectLiteralType(type) && !(getObjectFlags(type) & 2097152 /* ContainsSpread */)) {
|
@@ -59016,7 +59086,7 @@ function createTypeChecker(host) {
|
|
59016
59086
|
propTypes.push(type);
|
59017
59087
|
}
|
59018
59088
|
addRange(propTypes, indexTypes);
|
59019
|
-
const result = createSymbol(
|
59089
|
+
const result = createSymbol(propFlags | (optionalFlag ?? 0), name, syntheticFlag | checkFlags);
|
59020
59090
|
result.links.containingType = containingType;
|
59021
59091
|
if (!hasNonUniformValueDeclaration && firstValueDeclaration) {
|
59022
59092
|
result.valueDeclaration = firstValueDeclaration;
|
@@ -78649,6 +78719,9 @@ function createTypeChecker(host) {
|
|
78649
78719
|
return { yieldTypes, nextTypes };
|
78650
78720
|
}
|
78651
78721
|
function getYieldedTypeOfYieldExpression(node, expressionType, sentType, isAsync) {
|
78722
|
+
if (expressionType === silentNeverType) {
|
78723
|
+
return silentNeverType;
|
78724
|
+
}
|
78652
78725
|
const errorNode = node.expression || node;
|
78653
78726
|
const yieldedType = node.asteriskToken ? checkIteratedTypeOrElementType(isAsync ? 19 /* AsyncYieldStar */ : 17 /* YieldStar */, expressionType, sentType, errorNode) : expressionType;
|
78654
78727
|
return !isAsync ? yieldedType : getAwaitedType(
|
@@ -79682,17 +79755,27 @@ function createTypeChecker(host) {
|
|
79682
79755
|
}
|
79683
79756
|
}
|
79684
79757
|
function checkNullishCoalesceOperands(node) {
|
79685
|
-
|
79686
|
-
|
79687
|
-
|
79688
|
-
|
79758
|
+
if (node.operatorToken.kind !== 61 /* QuestionQuestionToken */) {
|
79759
|
+
return;
|
79760
|
+
}
|
79761
|
+
if (isBinaryExpression(node.parent)) {
|
79762
|
+
const { left, operatorToken } = node.parent;
|
79763
|
+
if (isBinaryExpression(left) && operatorToken.kind === 57 /* BarBarToken */) {
|
79764
|
+
grammarErrorOnNode(left, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(61 /* QuestionQuestionToken */), tokenToString(operatorToken.kind));
|
79689
79765
|
}
|
79690
|
-
|
79691
|
-
|
79766
|
+
} else if (isBinaryExpression(node.left)) {
|
79767
|
+
const { operatorToken } = node.left;
|
79768
|
+
if (operatorToken.kind === 57 /* BarBarToken */ || operatorToken.kind === 56 /* AmpersandAmpersandToken */) {
|
79769
|
+
grammarErrorOnNode(node.left, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(operatorToken.kind), tokenToString(61 /* QuestionQuestionToken */));
|
79770
|
+
}
|
79771
|
+
} else if (isBinaryExpression(node.right)) {
|
79772
|
+
const { operatorToken } = node.right;
|
79773
|
+
if (operatorToken.kind === 56 /* AmpersandAmpersandToken */) {
|
79774
|
+
grammarErrorOnNode(node.right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(61 /* QuestionQuestionToken */), tokenToString(operatorToken.kind));
|
79692
79775
|
}
|
79693
|
-
checkNullishCoalesceOperandLeft(node);
|
79694
|
-
checkNullishCoalesceOperandRight(node);
|
79695
79776
|
}
|
79777
|
+
checkNullishCoalesceOperandLeft(node);
|
79778
|
+
checkNullishCoalesceOperandRight(node);
|
79696
79779
|
}
|
79697
79780
|
function checkNullishCoalesceOperandLeft(node) {
|
79698
79781
|
const leftTarget = skipOuterExpressions(node.left, 63 /* All */);
|
@@ -83731,6 +83814,9 @@ function createTypeChecker(host) {
|
|
83731
83814
|
}
|
83732
83815
|
function getIterationTypesOfIterable(type, use, errorNode) {
|
83733
83816
|
var _a, _b;
|
83817
|
+
if (type === silentNeverType) {
|
83818
|
+
return silentNeverIterationTypes;
|
83819
|
+
}
|
83734
83820
|
if (isTypeAny(type)) {
|
83735
83821
|
return anyIterationTypes;
|
83736
83822
|
}
|
@@ -84456,7 +84542,7 @@ function createTypeChecker(host) {
|
|
84456
84542
|
}
|
84457
84543
|
function checkClassNameCollisionWithObject(name) {
|
84458
84544
|
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && host.getEmitModuleFormatOfFile(getSourceFileOfNode(name)) < 5 /* ES2015 */) {
|
84459
|
-
error(name, Diagnostics.
|
84545
|
+
error(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_and_above_with_module_0, ModuleKind[moduleKind]);
|
84460
84546
|
}
|
84461
84547
|
}
|
84462
84548
|
function checkUnmatchedJSDocParameters(node) {
|
@@ -128529,7 +128615,7 @@ function getMatchedIncludeSpec(program, fileName) {
|
|
128529
128615
|
const index = findIndex((_b = configFile == null ? void 0 : configFile.configFileSpecs) == null ? void 0 : _b.validatedIncludeSpecs, (includeSpec) => {
|
128530
128616
|
if (isJsonFile && !endsWith(includeSpec, ".json" /* Json */)) return false;
|
128531
128617
|
const pattern = getPatternFromSpec(includeSpec, basePath, "files");
|
128532
|
-
return !!pattern && getRegexFromPattern(`(
|
128618
|
+
return !!pattern && getRegexFromPattern(`(?:${pattern})$`, useCaseSensitiveFileNames2).test(fileName);
|
128533
128619
|
});
|
128534
128620
|
return index !== -1 ? configFile.configFileSpecs.validatedIncludeSpecsBeforeSubstitution[index] : void 0;
|
128535
128621
|
}
|
@@ -133464,7 +133550,8 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
133464
133550
|
function ensureParameter(p, context) {
|
133465
133551
|
return factory.updateParameterDeclaration(
|
133466
133552
|
p,
|
133467
|
-
|
133553
|
+
/*modifiers*/
|
133554
|
+
void 0,
|
133468
133555
|
reuseNode(context, p.dotDotDotToken),
|
133469
133556
|
resolver.serializeNameOfParameter(context, p),
|
133470
133557
|
resolver.isOptionalParameter(p) ? factory.createToken(58 /* QuestionToken */) : void 0,
|
package/lib/typescript.js
CHANGED
@@ -2285,7 +2285,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
2285
2285
|
|
2286
2286
|
// src/compiler/corePublic.ts
|
2287
2287
|
var versionMajorMinor = "5.9";
|
2288
|
-
var version = `${versionMajorMinor}.0-dev.
|
2288
|
+
var version = `${versionMajorMinor}.0-dev.20250701`;
|
2289
2289
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
2290
2290
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
2291
2291
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
@@ -10072,7 +10072,7 @@ var Diagnostics = {
|
|
10072
10072
|
Cannot_invoke_an_object_which_is_possibly_undefined: diag(2722, 1 /* Error */, "Cannot_invoke_an_object_which_is_possibly_undefined_2722", "Cannot invoke an object which is possibly 'undefined'."),
|
10073
10073
|
Cannot_invoke_an_object_which_is_possibly_null_or_undefined: diag(2723, 1 /* Error */, "Cannot_invoke_an_object_which_is_possibly_null_or_undefined_2723", "Cannot invoke an object which is possibly 'null' or 'undefined'."),
|
10074
10074
|
_0_has_no_exported_member_named_1_Did_you_mean_2: diag(2724, 1 /* Error */, "_0_has_no_exported_member_named_1_Did_you_mean_2_2724", "'{0}' has no exported member named '{1}'. Did you mean '{2}'?"),
|
10075
|
-
|
10075
|
+
Class_name_cannot_be_Object_when_targeting_ES5_and_above_with_module_0: diag(2725, 1 /* Error */, "Class_name_cannot_be_Object_when_targeting_ES5_and_above_with_module_0_2725", "Class name cannot be 'Object' when targeting ES5 and above with module {0}."),
|
10076
10076
|
Cannot_find_lib_definition_for_0: diag(2726, 1 /* Error */, "Cannot_find_lib_definition_for_0_2726", "Cannot find lib definition for '{0}'."),
|
10077
10077
|
Cannot_find_lib_definition_for_0_Did_you_mean_1: diag(2727, 1 /* Error */, "Cannot_find_lib_definition_for_0_Did_you_mean_1_2727", "Cannot find lib definition for '{0}'. Did you mean '{1}'?"),
|
10078
10078
|
_0_is_declared_here: diag(2728, 3 /* Message */, "_0_is_declared_here_2728", "'{0}' is declared here."),
|
@@ -19780,8 +19780,8 @@ var OperatorPrecedence = /* @__PURE__ */ ((OperatorPrecedence2) => {
|
|
19780
19780
|
OperatorPrecedence2[OperatorPrecedence2["Yield"] = 2] = "Yield";
|
19781
19781
|
OperatorPrecedence2[OperatorPrecedence2["Assignment"] = 3] = "Assignment";
|
19782
19782
|
OperatorPrecedence2[OperatorPrecedence2["Conditional"] = 4] = "Conditional";
|
19783
|
-
OperatorPrecedence2[OperatorPrecedence2["Coalesce"] = 4 /* Conditional */] = "Coalesce";
|
19784
19783
|
OperatorPrecedence2[OperatorPrecedence2["LogicalOR"] = 5] = "LogicalOR";
|
19784
|
+
OperatorPrecedence2[OperatorPrecedence2["Coalesce"] = 5 /* LogicalOR */] = "Coalesce";
|
19785
19785
|
OperatorPrecedence2[OperatorPrecedence2["LogicalAND"] = 6] = "LogicalAND";
|
19786
19786
|
OperatorPrecedence2[OperatorPrecedence2["BitwiseOR"] = 7] = "BitwiseOR";
|
19787
19787
|
OperatorPrecedence2[OperatorPrecedence2["BitwiseXOR"] = 8] = "BitwiseXOR";
|
@@ -19890,7 +19890,7 @@ function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
|
|
19890
19890
|
function getBinaryOperatorPrecedence(kind) {
|
19891
19891
|
switch (kind) {
|
19892
19892
|
case 61 /* QuestionQuestionToken */:
|
19893
|
-
return
|
19893
|
+
return 5 /* Coalesce */;
|
19894
19894
|
case 57 /* BarBarToken */:
|
19895
19895
|
return 5 /* LogicalOR */;
|
19896
19896
|
case 56 /* AmpersandAmpersandToken */:
|
@@ -22305,7 +22305,7 @@ function escapeRegExpCharacter(match) {
|
|
22305
22305
|
}
|
22306
22306
|
var wildcardCharCodes = [42 /* asterisk */, 63 /* question */];
|
22307
22307
|
var commonPackageFolders = ["node_modules", "bower_components", "jspm_packages"];
|
22308
|
-
var implicitExcludePathRegexPattern = `(?!(
|
22308
|
+
var implicitExcludePathRegexPattern = `(?!(?:${commonPackageFolders.join("|")})(?:/|$))`;
|
22309
22309
|
var filesMatcher = {
|
22310
22310
|
/**
|
22311
22311
|
* Matches any single directory segment unless it is the last segment and a .min.js file
|
@@ -22313,12 +22313,12 @@ var filesMatcher = {
|
|
22313
22313
|
* [^./] # matches everything up to the first . character (excluding directory separators)
|
22314
22314
|
* (\\.(?!min\\.js$))? # matches . characters but not if they are part of the .min.js file extension
|
22315
22315
|
*/
|
22316
|
-
singleAsteriskRegexFragment: "([^./]|(
|
22316
|
+
singleAsteriskRegexFragment: "(?:[^./]|(?:\\.(?!min\\.js$))?)*",
|
22317
22317
|
/**
|
22318
22318
|
* Regex for the ** wildcard. Matches any number of subdirectories. When used for including
|
22319
22319
|
* files or directories, does not match subdirectories that start with a . character
|
22320
22320
|
*/
|
22321
|
-
doubleAsteriskRegexFragment: `(
|
22321
|
+
doubleAsteriskRegexFragment: `(?:/${implicitExcludePathRegexPattern}[^/.][^/]*)*?`,
|
22322
22322
|
replaceWildcardCharacter: (match) => replaceWildcardCharacter(match, filesMatcher.singleAsteriskRegexFragment)
|
22323
22323
|
};
|
22324
22324
|
var directoriesMatcher = {
|
@@ -22327,12 +22327,12 @@ var directoriesMatcher = {
|
|
22327
22327
|
* Regex for the ** wildcard. Matches any number of subdirectories. When used for including
|
22328
22328
|
* files or directories, does not match subdirectories that start with a . character
|
22329
22329
|
*/
|
22330
|
-
doubleAsteriskRegexFragment: `(
|
22330
|
+
doubleAsteriskRegexFragment: `(?:/${implicitExcludePathRegexPattern}[^/.][^/]*)*?`,
|
22331
22331
|
replaceWildcardCharacter: (match) => replaceWildcardCharacter(match, directoriesMatcher.singleAsteriskRegexFragment)
|
22332
22332
|
};
|
22333
22333
|
var excludeMatcher = {
|
22334
22334
|
singleAsteriskRegexFragment: "[^/]*",
|
22335
|
-
doubleAsteriskRegexFragment: "(
|
22335
|
+
doubleAsteriskRegexFragment: "(?:/.+?)?",
|
22336
22336
|
replaceWildcardCharacter: (match) => replaceWildcardCharacter(match, excludeMatcher.singleAsteriskRegexFragment)
|
22337
22337
|
};
|
22338
22338
|
var wildcardMatchers = {
|
@@ -22345,9 +22345,9 @@ function getRegularExpressionForWildcard(specs, basePath, usage) {
|
|
22345
22345
|
if (!patterns || !patterns.length) {
|
22346
22346
|
return void 0;
|
22347
22347
|
}
|
22348
|
-
const pattern = patterns.map((pattern2) => `(
|
22349
|
-
const terminator = usage === "exclude" ? "(
|
22350
|
-
return `^(
|
22348
|
+
const pattern = patterns.map((pattern2) => `(?:${pattern2})`).join("|");
|
22349
|
+
const terminator = usage === "exclude" ? "(?:$|/)" : "$";
|
22350
|
+
return `^(?:${pattern})${terminator}`;
|
22351
22351
|
}
|
22352
22352
|
function getRegularExpressionsForWildcards(specs, basePath, usage) {
|
22353
22353
|
if (specs === void 0 || specs.length === 0) {
|
@@ -22360,7 +22360,7 @@ function isImplicitGlob(lastPathComponent) {
|
|
22360
22360
|
}
|
22361
22361
|
function getPatternFromSpec(spec, basePath, usage) {
|
22362
22362
|
const pattern = spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]);
|
22363
|
-
return pattern && `^(
|
22363
|
+
return pattern && `^(?:${pattern})${usage === "exclude" ? "(?:$|/)" : "$"}`;
|
22364
22364
|
}
|
22365
22365
|
function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter: replaceWildcardCharacter2 } = wildcardMatchers[usage]) {
|
22366
22366
|
let subpattern = "";
|
@@ -22380,7 +22380,7 @@ function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragm
|
|
22380
22380
|
subpattern += doubleAsteriskRegexFragment;
|
22381
22381
|
} else {
|
22382
22382
|
if (usage === "directories") {
|
22383
|
-
subpattern += "(";
|
22383
|
+
subpattern += "(?:";
|
22384
22384
|
optionalCount++;
|
22385
22385
|
}
|
22386
22386
|
if (hasWrittenComponent) {
|
@@ -22389,7 +22389,7 @@ function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragm
|
|
22389
22389
|
if (usage !== "exclude") {
|
22390
22390
|
let componentPattern = "";
|
22391
22391
|
if (component.charCodeAt(0) === 42 /* asterisk */) {
|
22392
|
-
componentPattern += "([^./]" + singleAsteriskRegexFragment + ")?";
|
22392
|
+
componentPattern += "(?:[^./]" + singleAsteriskRegexFragment + ")?";
|
22393
22393
|
component = component.substr(1);
|
22394
22394
|
} else if (component.charCodeAt(0) === 63 /* question */) {
|
22395
22395
|
componentPattern += "[^./]";
|
@@ -36237,10 +36237,13 @@ var Parser;
|
|
36237
36237
|
if (token() !== 27 /* SemicolonToken */ && token() !== 100 /* FunctionKeyword */ && token() !== 86 /* ClassKeyword */ && isStartOfStatement() && !isStartOfExpressionStatement()) {
|
36238
36238
|
return parseFunctionBlock(16 /* IgnoreMissingOpenBrace */ | (isAsync ? 2 /* Await */ : 0 /* None */));
|
36239
36239
|
}
|
36240
|
+
const savedYieldContext = inYieldContext();
|
36241
|
+
setYieldContext(false);
|
36240
36242
|
const savedTopLevel = topLevel;
|
36241
36243
|
topLevel = false;
|
36242
36244
|
const node = isAsync ? doInAwaitContext(() => parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction)) : doOutsideOfAwaitContext(() => parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction));
|
36243
36245
|
topLevel = savedTopLevel;
|
36246
|
+
setYieldContext(savedYieldContext);
|
36244
36247
|
return node;
|
36245
36248
|
}
|
36246
36249
|
function parseConditionalExpressionRest(leftOperand, pos, allowReturnTypeInArrowFunction) {
|
@@ -51835,6 +51838,7 @@ function createTypeChecker(host) {
|
|
51835
51838
|
}
|
51836
51839
|
};
|
51837
51840
|
var anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
|
51841
|
+
var silentNeverIterationTypes = createIterationTypes(silentNeverType, silentNeverType, silentNeverType);
|
51838
51842
|
var asyncIterationTypesResolver = {
|
51839
51843
|
iterableCacheKey: "iterationTypesOfAsyncIterable",
|
51840
51844
|
iteratorCacheKey: "iterationTypesOfAsyncIterator",
|
@@ -55048,7 +55052,14 @@ function createTypeChecker(host) {
|
|
55048
55052
|
if (symbol.flags & 2097152 /* Alias */ && isInJSFile(declaration) && ((_a = declaration.parent) == null ? void 0 : _a.parent) && isVariableDeclaration(declaration.parent.parent) && ((_b = declaration.parent.parent.parent) == null ? void 0 : _b.parent) && isVariableStatement(declaration.parent.parent.parent.parent) && !hasSyntacticModifier(declaration.parent.parent.parent.parent, 32 /* Export */) && declaration.parent.parent.parent.parent.parent && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) {
|
55049
55053
|
return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
|
55050
55054
|
} else if (symbol.flags & 2 /* BlockScopedVariable */) {
|
55051
|
-
const
|
55055
|
+
const rootDeclaration = walkUpBindingElementsAndPatterns(declaration);
|
55056
|
+
if (rootDeclaration.kind === 170 /* Parameter */) {
|
55057
|
+
return false;
|
55058
|
+
}
|
55059
|
+
const variableStatement = rootDeclaration.parent.parent;
|
55060
|
+
if (variableStatement.kind !== 244 /* VariableStatement */) {
|
55061
|
+
return false;
|
55062
|
+
}
|
55052
55063
|
if (hasSyntacticModifier(variableStatement, 32 /* Export */)) {
|
55053
55064
|
return true;
|
55054
55065
|
}
|
@@ -56742,27 +56753,77 @@ function createTypeChecker(host) {
|
|
56742
56753
|
context.approximateLength += symbolName(propertySymbol).length + 1;
|
56743
56754
|
if (propertySymbol.flags & 98304 /* Accessor */) {
|
56744
56755
|
const writeType = getWriteTypeOfSymbol(propertySymbol);
|
56745
|
-
if (
|
56756
|
+
if (!isErrorType(propertyType) && !isErrorType(writeType)) {
|
56746
56757
|
const symbolMapper = getSymbolLinks(propertySymbol).mapper;
|
56747
|
-
const
|
56748
|
-
|
56749
|
-
|
56750
|
-
|
56751
|
-
|
56752
|
-
|
56753
|
-
|
56754
|
-
|
56755
|
-
|
56756
|
-
|
56757
|
-
|
56758
|
-
|
56759
|
-
|
56760
|
-
|
56761
|
-
|
56762
|
-
setterDeclaration
|
56763
|
-
|
56764
|
-
|
56765
|
-
|
56758
|
+
const propDeclaration = getDeclarationOfKind(propertySymbol, 173 /* PropertyDeclaration */);
|
56759
|
+
if (propertyType !== writeType || propertySymbol.parent.flags & 32 /* Class */ && !propDeclaration) {
|
56760
|
+
const getterDeclaration = getDeclarationOfKind(propertySymbol, 178 /* GetAccessor */);
|
56761
|
+
if (getterDeclaration) {
|
56762
|
+
const getterSignature = getSignatureFromDeclaration(getterDeclaration);
|
56763
|
+
typeElements.push(
|
56764
|
+
setCommentRange2(
|
56765
|
+
context,
|
56766
|
+
signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(getterSignature, symbolMapper) : getterSignature, 178 /* GetAccessor */, context, { name: propertyName }),
|
56767
|
+
getterDeclaration
|
56768
|
+
)
|
56769
|
+
);
|
56770
|
+
}
|
56771
|
+
const setterDeclaration = getDeclarationOfKind(propertySymbol, 179 /* SetAccessor */);
|
56772
|
+
if (setterDeclaration) {
|
56773
|
+
const setterSignature = getSignatureFromDeclaration(setterDeclaration);
|
56774
|
+
typeElements.push(
|
56775
|
+
setCommentRange2(
|
56776
|
+
context,
|
56777
|
+
signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(setterSignature, symbolMapper) : setterSignature, 179 /* SetAccessor */, context, { name: propertyName }),
|
56778
|
+
setterDeclaration
|
56779
|
+
)
|
56780
|
+
);
|
56781
|
+
}
|
56782
|
+
return;
|
56783
|
+
}
|
56784
|
+
if (propertySymbol.parent.flags & 32 /* Class */ && propDeclaration && find(propDeclaration.modifiers, isAccessorModifier)) {
|
56785
|
+
const fakeGetterSignature = createSignature(
|
56786
|
+
/*declaration*/
|
56787
|
+
void 0,
|
56788
|
+
/*typeParameters*/
|
56789
|
+
void 0,
|
56790
|
+
/*thisParameter*/
|
56791
|
+
void 0,
|
56792
|
+
emptyArray,
|
56793
|
+
propertyType,
|
56794
|
+
/*resolvedTypePredicate*/
|
56795
|
+
void 0,
|
56796
|
+
0,
|
56797
|
+
0 /* None */
|
56798
|
+
);
|
56799
|
+
typeElements.push(
|
56800
|
+
setCommentRange2(
|
56801
|
+
context,
|
56802
|
+
signatureToSignatureDeclarationHelper(fakeGetterSignature, 178 /* GetAccessor */, context, { name: propertyName }),
|
56803
|
+
propDeclaration
|
56804
|
+
)
|
56805
|
+
);
|
56806
|
+
const setterParam = createSymbol(1 /* FunctionScopedVariable */, "arg");
|
56807
|
+
setterParam.links.type = writeType;
|
56808
|
+
const fakeSetterSignature = createSignature(
|
56809
|
+
/*declaration*/
|
56810
|
+
void 0,
|
56811
|
+
/*typeParameters*/
|
56812
|
+
void 0,
|
56813
|
+
/*thisParameter*/
|
56814
|
+
void 0,
|
56815
|
+
[setterParam],
|
56816
|
+
voidType,
|
56817
|
+
/*resolvedTypePredicate*/
|
56818
|
+
void 0,
|
56819
|
+
0,
|
56820
|
+
0 /* None */
|
56821
|
+
);
|
56822
|
+
typeElements.push(
|
56823
|
+
signatureToSignatureDeclarationHelper(fakeSetterSignature, 179 /* SetAccessor */, context, { name: propertyName })
|
56824
|
+
);
|
56825
|
+
return;
|
56826
|
+
}
|
56766
56827
|
}
|
56767
56828
|
}
|
56768
56829
|
const optionalToken = propertySymbol.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0;
|
@@ -61353,11 +61414,14 @@ function createTypeChecker(host) {
|
|
61353
61414
|
}
|
61354
61415
|
function getWriteTypeOfSymbol(symbol) {
|
61355
61416
|
const checkFlags = getCheckFlags(symbol);
|
61356
|
-
if (
|
61357
|
-
return checkFlags &
|
61417
|
+
if (checkFlags & 2 /* SyntheticProperty */) {
|
61418
|
+
return checkFlags & 65536 /* DeferredType */ ? getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) : (
|
61358
61419
|
// NOTE: cast to TransientSymbol should be safe because only TransientSymbols can have CheckFlags.SyntheticProperty
|
61359
61420
|
symbol.links.writeType || symbol.links.type
|
61360
|
-
)
|
61421
|
+
);
|
61422
|
+
}
|
61423
|
+
if (symbol.flags & 4 /* Property */) {
|
61424
|
+
return removeMissingType(getTypeOfSymbol(symbol), !!(symbol.flags & 16777216 /* Optional */));
|
61361
61425
|
}
|
61362
61426
|
if (symbol.flags & 98304 /* Accessor */) {
|
61363
61427
|
return checkFlags & 1 /* Instantiated */ ? getWriteTypeOfInstantiatedSymbol(symbol) : getWriteTypeOfAccessors(symbol);
|
@@ -63513,6 +63577,7 @@ function createTypeChecker(host) {
|
|
63513
63577
|
}
|
63514
63578
|
function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) {
|
63515
63579
|
var _a, _b, _c;
|
63580
|
+
let propFlags = 0 /* None */;
|
63516
63581
|
let singleProp;
|
63517
63582
|
let propSet;
|
63518
63583
|
let indexTypes;
|
@@ -63537,6 +63602,7 @@ function createTypeChecker(host) {
|
|
63537
63602
|
}
|
63538
63603
|
if (!singleProp) {
|
63539
63604
|
singleProp = prop;
|
63605
|
+
propFlags = prop.flags & 98304 /* Accessor */ || 4 /* Property */;
|
63540
63606
|
} else if (prop !== singleProp) {
|
63541
63607
|
const isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp);
|
63542
63608
|
if (isInstantiation && compareProperties2(singleProp, prop, (a, b) => a === b ? -1 /* True */ : 0 /* False */) === -1 /* True */) {
|
@@ -63551,6 +63617,9 @@ function createTypeChecker(host) {
|
|
63551
63617
|
propSet.set(id, prop);
|
63552
63618
|
}
|
63553
63619
|
}
|
63620
|
+
if (propFlags & 98304 /* Accessor */ && (prop.flags & 98304 /* Accessor */) !== (propFlags & 98304 /* Accessor */)) {
|
63621
|
+
propFlags = propFlags & ~98304 /* Accessor */ | 4 /* Property */;
|
63622
|
+
}
|
63554
63623
|
}
|
63555
63624
|
if (isUnion && isReadonlySymbol(prop)) {
|
63556
63625
|
checkFlags |= 8 /* Readonly */;
|
@@ -63564,6 +63633,7 @@ function createTypeChecker(host) {
|
|
63564
63633
|
} else if (isUnion) {
|
63565
63634
|
const indexInfo = !isLateBoundName(name) && getApplicableIndexInfoForName(type, name);
|
63566
63635
|
if (indexInfo) {
|
63636
|
+
propFlags = propFlags & ~98304 /* Accessor */ | 4 /* Property */;
|
63567
63637
|
checkFlags |= 32 /* WritePartial */ | (indexInfo.isReadonly ? 8 /* Readonly */ : 0);
|
63568
63638
|
indexTypes = append(indexTypes, isTupleType(type) ? getRestTypeOfTupleType(type) || undefinedType : indexInfo.type);
|
63569
63639
|
} else if (isObjectLiteralType2(type) && !(getObjectFlags(type) & 2097152 /* ContainsSpread */)) {
|
@@ -63627,7 +63697,7 @@ function createTypeChecker(host) {
|
|
63627
63697
|
propTypes.push(type);
|
63628
63698
|
}
|
63629
63699
|
addRange(propTypes, indexTypes);
|
63630
|
-
const result = createSymbol(
|
63700
|
+
const result = createSymbol(propFlags | (optionalFlag ?? 0), name, syntheticFlag | checkFlags);
|
63631
63701
|
result.links.containingType = containingType;
|
63632
63702
|
if (!hasNonUniformValueDeclaration && firstValueDeclaration) {
|
63633
63703
|
result.valueDeclaration = firstValueDeclaration;
|
@@ -83260,6 +83330,9 @@ function createTypeChecker(host) {
|
|
83260
83330
|
return { yieldTypes, nextTypes };
|
83261
83331
|
}
|
83262
83332
|
function getYieldedTypeOfYieldExpression(node, expressionType, sentType, isAsync) {
|
83333
|
+
if (expressionType === silentNeverType) {
|
83334
|
+
return silentNeverType;
|
83335
|
+
}
|
83263
83336
|
const errorNode = node.expression || node;
|
83264
83337
|
const yieldedType = node.asteriskToken ? checkIteratedTypeOrElementType(isAsync ? 19 /* AsyncYieldStar */ : 17 /* YieldStar */, expressionType, sentType, errorNode) : expressionType;
|
83265
83338
|
return !isAsync ? yieldedType : getAwaitedType(
|
@@ -84293,17 +84366,27 @@ function createTypeChecker(host) {
|
|
84293
84366
|
}
|
84294
84367
|
}
|
84295
84368
|
function checkNullishCoalesceOperands(node) {
|
84296
|
-
|
84297
|
-
|
84298
|
-
|
84299
|
-
|
84369
|
+
if (node.operatorToken.kind !== 61 /* QuestionQuestionToken */) {
|
84370
|
+
return;
|
84371
|
+
}
|
84372
|
+
if (isBinaryExpression(node.parent)) {
|
84373
|
+
const { left, operatorToken } = node.parent;
|
84374
|
+
if (isBinaryExpression(left) && operatorToken.kind === 57 /* BarBarToken */) {
|
84375
|
+
grammarErrorOnNode(left, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(61 /* QuestionQuestionToken */), tokenToString(operatorToken.kind));
|
84376
|
+
}
|
84377
|
+
} else if (isBinaryExpression(node.left)) {
|
84378
|
+
const { operatorToken } = node.left;
|
84379
|
+
if (operatorToken.kind === 57 /* BarBarToken */ || operatorToken.kind === 56 /* AmpersandAmpersandToken */) {
|
84380
|
+
grammarErrorOnNode(node.left, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(operatorToken.kind), tokenToString(61 /* QuestionQuestionToken */));
|
84300
84381
|
}
|
84301
|
-
|
84302
|
-
|
84382
|
+
} else if (isBinaryExpression(node.right)) {
|
84383
|
+
const { operatorToken } = node.right;
|
84384
|
+
if (operatorToken.kind === 56 /* AmpersandAmpersandToken */) {
|
84385
|
+
grammarErrorOnNode(node.right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(61 /* QuestionQuestionToken */), tokenToString(operatorToken.kind));
|
84303
84386
|
}
|
84304
|
-
checkNullishCoalesceOperandLeft(node);
|
84305
|
-
checkNullishCoalesceOperandRight(node);
|
84306
84387
|
}
|
84388
|
+
checkNullishCoalesceOperandLeft(node);
|
84389
|
+
checkNullishCoalesceOperandRight(node);
|
84307
84390
|
}
|
84308
84391
|
function checkNullishCoalesceOperandLeft(node) {
|
84309
84392
|
const leftTarget = skipOuterExpressions(node.left, 63 /* All */);
|
@@ -88342,6 +88425,9 @@ function createTypeChecker(host) {
|
|
88342
88425
|
}
|
88343
88426
|
function getIterationTypesOfIterable(type, use, errorNode) {
|
88344
88427
|
var _a, _b;
|
88428
|
+
if (type === silentNeverType) {
|
88429
|
+
return silentNeverIterationTypes;
|
88430
|
+
}
|
88345
88431
|
if (isTypeAny(type)) {
|
88346
88432
|
return anyIterationTypes;
|
88347
88433
|
}
|
@@ -89067,7 +89153,7 @@ function createTypeChecker(host) {
|
|
89067
89153
|
}
|
89068
89154
|
function checkClassNameCollisionWithObject(name) {
|
89069
89155
|
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && host.getEmitModuleFormatOfFile(getSourceFileOfNode(name)) < 5 /* ES2015 */) {
|
89070
|
-
error2(name, Diagnostics.
|
89156
|
+
error2(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_and_above_with_module_0, ModuleKind[moduleKind]);
|
89071
89157
|
}
|
89072
89158
|
}
|
89073
89159
|
function checkUnmatchedJSDocParameters(node) {
|
@@ -133440,7 +133526,7 @@ function getMatchedIncludeSpec(program, fileName) {
|
|
133440
133526
|
const index = findIndex((_b = configFile == null ? void 0 : configFile.configFileSpecs) == null ? void 0 : _b.validatedIncludeSpecs, (includeSpec) => {
|
133441
133527
|
if (isJsonFile && !endsWith(includeSpec, ".json" /* Json */)) return false;
|
133442
133528
|
const pattern = getPatternFromSpec(includeSpec, basePath, "files");
|
133443
|
-
return !!pattern && getRegexFromPattern(`(
|
133529
|
+
return !!pattern && getRegexFromPattern(`(?:${pattern})$`, useCaseSensitiveFileNames2).test(fileName);
|
133444
133530
|
});
|
133445
133531
|
return index !== -1 ? configFile.configFileSpecs.validatedIncludeSpecsBeforeSubstitution[index] : void 0;
|
133446
133532
|
}
|
@@ -138432,7 +138518,8 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
138432
138518
|
function ensureParameter(p, context) {
|
138433
138519
|
return factory.updateParameterDeclaration(
|
138434
138520
|
p,
|
138435
|
-
|
138521
|
+
/*modifiers*/
|
138522
|
+
void 0,
|
138436
138523
|
reuseNode(context, p.dotDotDotToken),
|
138437
138524
|
resolver.serializeNameOfParameter(context, p),
|
138438
138525
|
resolver.isOptionalParameter(p) ? factory.createToken(58 /* QuestionToken */) : void 0,
|
@@ -153973,6 +154060,7 @@ function getContainingObjectLiteralElementWorker(node) {
|
|
153973
154060
|
}
|
153974
154061
|
// falls through
|
153975
154062
|
case 80 /* Identifier */:
|
154063
|
+
case 296 /* JsxNamespacedName */:
|
153976
154064
|
return isObjectLiteralElement(node.parent) && (node.parent.parent.kind === 211 /* ObjectLiteralExpression */ || node.parent.parent.kind === 293 /* JsxAttributes */) && node.parent.name === node ? node.parent : void 0;
|
153977
154065
|
}
|
153978
154066
|
return void 0;
|
@@ -155026,7 +155114,6 @@ __export(ts_codefix_exports, {
|
|
155026
155114
|
generateAccessorFromProperty: () => generateAccessorFromProperty,
|
155027
155115
|
getAccessorConvertiblePropertyAtPosition: () => getAccessorConvertiblePropertyAtPosition,
|
155028
155116
|
getAllFixes: () => getAllFixes,
|
155029
|
-
getAllSupers: () => getAllSupers,
|
155030
155117
|
getFixes: () => getFixes,
|
155031
155118
|
getImportCompletionAction: () => getImportCompletionAction,
|
155032
155119
|
getImportKind: () => getImportKind,
|
@@ -161248,6 +161335,20 @@ function findScope(node) {
|
|
161248
161335
|
}
|
161249
161336
|
return getSourceFileOfNode(node);
|
161250
161337
|
}
|
161338
|
+
function getAllSupers(decl, checker) {
|
161339
|
+
const res = [];
|
161340
|
+
while (decl) {
|
161341
|
+
const superElement = getClassExtendsHeritageElement(decl);
|
161342
|
+
const superSymbol = superElement && checker.getSymbolAtLocation(superElement.expression);
|
161343
|
+
if (!superSymbol) break;
|
161344
|
+
const symbol = superSymbol.flags & 2097152 /* Alias */ ? checker.getAliasedSymbol(superSymbol) : superSymbol;
|
161345
|
+
const superDecl = symbol.declarations && find(symbol.declarations, isClassLike);
|
161346
|
+
if (!superDecl) break;
|
161347
|
+
res.push(superDecl);
|
161348
|
+
decl = superDecl;
|
161349
|
+
}
|
161350
|
+
return res;
|
161351
|
+
}
|
161251
161352
|
|
161252
161353
|
// src/services/codefixes/fixAddMissingNewOperator.ts
|
161253
161354
|
var fixId25 = "addMissingNewOperator";
|
@@ -163668,14 +163769,20 @@ function doChange32(file, start, length2, code, context) {
|
|
163668
163769
|
} else if (code === Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor.code) {
|
163669
163770
|
const checker = context.program.getTypeChecker();
|
163670
163771
|
const node = getTokenAtPosition(file, start).parent;
|
163772
|
+
if (isComputedPropertyName(node)) {
|
163773
|
+
return;
|
163774
|
+
}
|
163671
163775
|
Debug.assert(isAccessor(node), "error span of fixPropertyOverrideAccessor should only be on an accessor");
|
163672
163776
|
const containingClass = node.parent;
|
163673
163777
|
Debug.assert(isClassLike(containingClass), "erroneous accessors should only be inside classes");
|
163674
|
-
const
|
163675
|
-
if (!
|
163676
|
-
const
|
163677
|
-
const
|
163678
|
-
if (!
|
163778
|
+
const baseTypeNode = getEffectiveBaseTypeNode(containingClass);
|
163779
|
+
if (!baseTypeNode) return;
|
163780
|
+
const expression = skipParentheses(baseTypeNode.expression);
|
163781
|
+
const base = isClassExpression(expression) ? expression.symbol : checker.getSymbolAtLocation(expression);
|
163782
|
+
if (!base) return;
|
163783
|
+
const baseType = checker.getDeclaredTypeOfSymbol(base);
|
163784
|
+
const baseProp = checker.getPropertyOfType(baseType, unescapeLeadingUnderscores(getTextOfPropertyName(node.name)));
|
163785
|
+
if (!baseProp || !baseProp.valueDeclaration) return;
|
163679
163786
|
startPosition = baseProp.valueDeclaration.pos;
|
163680
163787
|
endPosition = baseProp.valueDeclaration.end;
|
163681
163788
|
file = getSourceFileOfNode(baseProp.valueDeclaration);
|
@@ -165742,20 +165849,6 @@ function getDeclarationType(declaration, program) {
|
|
165742
165849
|
}
|
165743
165850
|
return typeNode;
|
165744
165851
|
}
|
165745
|
-
function getAllSupers(decl, checker) {
|
165746
|
-
const res = [];
|
165747
|
-
while (decl) {
|
165748
|
-
const superElement = getClassExtendsHeritageElement(decl);
|
165749
|
-
const superSymbol = superElement && checker.getSymbolAtLocation(superElement.expression);
|
165750
|
-
if (!superSymbol) break;
|
165751
|
-
const symbol = superSymbol.flags & 2097152 /* Alias */ ? checker.getAliasedSymbol(superSymbol) : superSymbol;
|
165752
|
-
const superDecl = symbol.declarations && find(symbol.declarations, isClassLike);
|
165753
|
-
if (!superDecl) break;
|
165754
|
-
res.push(superDecl);
|
165755
|
-
decl = superDecl;
|
165756
|
-
}
|
165757
|
-
return res;
|
165758
|
-
}
|
165759
165852
|
|
165760
165853
|
// src/services/codefixes/fixInvalidImportSyntax.ts
|
165761
165854
|
var fixName5 = "invalidImportSyntax";
|
@@ -174356,10 +174449,23 @@ function getDefinitionFromOverriddenMember(typeChecker, node) {
|
|
174356
174449
|
const expression = skipParentheses(baseTypeNode.expression);
|
174357
174450
|
const base = isClassExpression(expression) ? expression.symbol : typeChecker.getSymbolAtLocation(expression);
|
174358
174451
|
if (!base) return;
|
174359
|
-
const
|
174360
|
-
|
174361
|
-
if (
|
174362
|
-
|
174452
|
+
const baseType = hasStaticModifier(classElement) ? typeChecker.getTypeOfSymbol(base) : typeChecker.getDeclaredTypeOfSymbol(base);
|
174453
|
+
let baseProp;
|
174454
|
+
if (isComputedPropertyName(classElement.name)) {
|
174455
|
+
const prop = typeChecker.getSymbolAtLocation(classElement.name);
|
174456
|
+
if (!prop) {
|
174457
|
+
return;
|
174458
|
+
}
|
174459
|
+
if (isKnownSymbol(prop)) {
|
174460
|
+
baseProp = find(typeChecker.getPropertiesOfType(baseType), (s) => s.escapedName === prop.escapedName);
|
174461
|
+
} else {
|
174462
|
+
baseProp = typeChecker.getPropertyOfType(baseType, unescapeLeadingUnderscores(prop.escapedName));
|
174463
|
+
}
|
174464
|
+
} else {
|
174465
|
+
baseProp = typeChecker.getPropertyOfType(baseType, unescapeLeadingUnderscores(getTextOfPropertyName(classElement.name)));
|
174466
|
+
}
|
174467
|
+
if (!baseProp) return;
|
174468
|
+
return getDefinitionFromSymbol(typeChecker, baseProp, node);
|
174363
174469
|
}
|
174364
174470
|
function getReferenceAtPosition(sourceFile, position, program) {
|
174365
174471
|
var _a, _b;
|
@@ -175396,6 +175502,15 @@ function provideInlayHints(context) {
|
|
175396
175502
|
visitForDisplayParts(node2.type);
|
175397
175503
|
}
|
175398
175504
|
break;
|
175505
|
+
case 181 /* ConstructSignature */:
|
175506
|
+
Debug.assertNode(node2, isConstructSignatureDeclaration);
|
175507
|
+
parts.push({ text: "new " });
|
175508
|
+
visitParametersAndTypeParameters(node2);
|
175509
|
+
if (node2.type) {
|
175510
|
+
parts.push({ text: ": " });
|
175511
|
+
visitForDisplayParts(node2.type);
|
175512
|
+
}
|
175513
|
+
break;
|
175399
175514
|
case 208 /* ArrayBindingPattern */:
|
175400
175515
|
Debug.assertNode(node2, isArrayBindingPattern);
|
175401
175516
|
parts.push({ text: "[" });
|
@@ -175447,6 +175562,12 @@ function provideInlayHints(context) {
|
|
175447
175562
|
Debug.assertNode(node2, isThisTypeNode);
|
175448
175563
|
parts.push({ text: "this" });
|
175449
175564
|
break;
|
175565
|
+
case 168 /* ComputedPropertyName */:
|
175566
|
+
Debug.assertNode(node2, isComputedPropertyName);
|
175567
|
+
parts.push({ text: "[" });
|
175568
|
+
visitForDisplayParts(node2.expression);
|
175569
|
+
parts.push({ text: "]" });
|
175570
|
+
break;
|
175450
175571
|
default:
|
175451
175572
|
Debug.failBadSyntaxKind(node2);
|
175452
175573
|
}
|
@@ -178630,7 +178751,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
178630
178751
|
}) || emptyArray;
|
178631
178752
|
}
|
178632
178753
|
}
|
178633
|
-
if (tags.length === 0 && !hasMultipleSignatures) {
|
178754
|
+
if (tags.length === 0 && !hasMultipleSignatures && !isInJSDoc(location)) {
|
178634
178755
|
tags = symbol.getContextualJsDocTags(enclosingDeclaration, typeChecker);
|
178635
178756
|
}
|
178636
178757
|
if (documentation.length === 0 && documentationFromAlias) {
|
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.9.0-dev.
|
5
|
+
"version": "5.9.0-dev.20250701",
|
6
6
|
"license": "Apache-2.0",
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
8
8
|
"keywords": [
|
@@ -116,5 +116,5 @@
|
|
116
116
|
"node": "20.1.0",
|
117
117
|
"npm": "8.19.4"
|
118
118
|
},
|
119
|
-
"gitHead": "
|
119
|
+
"gitHead": "3ba257fface990ec5ec59fa2bb8edd7a721e1013"
|
120
120
|
}
|