typescript 5.7.0-dev.20241022 → 5.7.0-dev.20241024
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 +128 -41
- package/lib/typescript.js +143 -47
- 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.7";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20241024`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -45041,31 +45041,29 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
45041
45041
|
return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
|
|
45042
45042
|
}
|
|
45043
45043
|
}
|
|
45044
|
-
|
|
45045
|
-
|
|
45046
|
-
|
|
45047
|
-
|
|
45048
|
-
|
|
45049
|
-
|
|
45050
|
-
|
|
45051
|
-
|
|
45052
|
-
|
|
45053
|
-
|
|
45054
|
-
|
|
45055
|
-
|
|
45056
|
-
|
|
45057
|
-
|
|
45058
|
-
|
|
45059
|
-
|
|
45060
|
-
|
|
45061
|
-
if (pathContainsNodeModules(local)) {
|
|
45062
|
-
relativeSpecifiers = append(relativeSpecifiers, local);
|
|
45063
|
-
} else {
|
|
45064
|
-
pathsSpecifiers = append(pathsSpecifiers, local);
|
|
45065
|
-
}
|
|
45066
|
-
} else if (forAutoImport || !importedFileIsInNodeModules || modulePath.isInNodeModules) {
|
|
45044
|
+
const local = getLocalModuleSpecifier(
|
|
45045
|
+
modulePath.path,
|
|
45046
|
+
info,
|
|
45047
|
+
compilerOptions,
|
|
45048
|
+
host,
|
|
45049
|
+
options.overrideImportMode || importingSourceFile.impliedNodeFormat,
|
|
45050
|
+
preferences,
|
|
45051
|
+
/*pathsOnly*/
|
|
45052
|
+
modulePath.isRedirect || !!specifier
|
|
45053
|
+
);
|
|
45054
|
+
if (!local || forAutoImport && isExcludedByRegex(local, preferences.excludeRegexes)) {
|
|
45055
|
+
continue;
|
|
45056
|
+
}
|
|
45057
|
+
if (modulePath.isRedirect) {
|
|
45058
|
+
redirectPathsSpecifiers = append(redirectPathsSpecifiers, local);
|
|
45059
|
+
} else if (pathIsBareSpecifier(local)) {
|
|
45060
|
+
if (pathContainsNodeModules(local)) {
|
|
45067
45061
|
relativeSpecifiers = append(relativeSpecifiers, local);
|
|
45062
|
+
} else {
|
|
45063
|
+
pathsSpecifiers = append(pathsSpecifiers, local);
|
|
45068
45064
|
}
|
|
45065
|
+
} else if (forAutoImport || !importedFileIsInNodeModules || modulePath.isInNodeModules) {
|
|
45066
|
+
relativeSpecifiers = append(relativeSpecifiers, local);
|
|
45069
45067
|
}
|
|
45070
45068
|
}
|
|
45071
45069
|
return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? { kind: "paths", moduleSpecifiers: pathsSpecifiers, computedWithoutCache: true } : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? { kind: "redirect", moduleSpecifiers: redirectPathsSpecifiers, computedWithoutCache: true } : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true } : { kind: "relative", moduleSpecifiers: relativeSpecifiers ?? emptyArray, computedWithoutCache: true };
|
|
@@ -51346,7 +51344,7 @@ function createTypeChecker(host) {
|
|
|
51346
51344
|
const signatures = getSignaturesOfType(filterType(propertyType, (t) => !(t.flags & 32768 /* Undefined */)), 0 /* Call */);
|
|
51347
51345
|
for (const signature of signatures) {
|
|
51348
51346
|
const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 173 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
|
|
51349
|
-
typeElements.push(preserveCommentsOn(methodDeclaration));
|
|
51347
|
+
typeElements.push(preserveCommentsOn(methodDeclaration, signature.declaration || propertySymbol.valueDeclaration));
|
|
51350
51348
|
}
|
|
51351
51349
|
if (signatures.length || !optionalToken) {
|
|
51352
51350
|
return;
|
|
@@ -51381,8 +51379,8 @@ function createTypeChecker(host) {
|
|
|
51381
51379
|
optionalToken,
|
|
51382
51380
|
propertyTypeNode
|
|
51383
51381
|
);
|
|
51384
|
-
typeElements.push(preserveCommentsOn(propertySignature));
|
|
51385
|
-
function preserveCommentsOn(node) {
|
|
51382
|
+
typeElements.push(preserveCommentsOn(propertySignature, propertySymbol.valueDeclaration));
|
|
51383
|
+
function preserveCommentsOn(node, range) {
|
|
51386
51384
|
var _a2;
|
|
51387
51385
|
const jsdocPropertyTag = (_a2 = propertySymbol.declarations) == null ? void 0 : _a2.find((d) => d.kind === 348 /* JSDocPropertyTag */);
|
|
51388
51386
|
if (jsdocPropertyTag) {
|
|
@@ -51390,8 +51388,8 @@ function createTypeChecker(host) {
|
|
|
51390
51388
|
if (commentText) {
|
|
51391
51389
|
setSyntheticLeadingComments(node, [{ kind: 3 /* MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]);
|
|
51392
51390
|
}
|
|
51393
|
-
} else if (
|
|
51394
|
-
setCommentRange2(context, node,
|
|
51391
|
+
} else if (range) {
|
|
51392
|
+
setCommentRange2(context, node, range);
|
|
51395
51393
|
}
|
|
51396
51394
|
return node;
|
|
51397
51395
|
}
|
|
@@ -82579,7 +82577,7 @@ function createTypeChecker(host) {
|
|
|
82579
82577
|
return anyIterationTypes;
|
|
82580
82578
|
}
|
|
82581
82579
|
if (!(type.flags & 1048576 /* Union */)) {
|
|
82582
|
-
const errorOutputContainer = errorNode ? { errors: void 0 } : void 0;
|
|
82580
|
+
const errorOutputContainer = errorNode ? { errors: void 0, skipLogging: true } : void 0;
|
|
82583
82581
|
const iterationTypes2 = getIterationTypesOfIterableWorker(type, use, errorNode, errorOutputContainer);
|
|
82584
82582
|
if (iterationTypes2 === noIterationTypes) {
|
|
82585
82583
|
if (errorNode) {
|
|
@@ -82747,11 +82745,27 @@ function createTypeChecker(host) {
|
|
|
82747
82745
|
if (isTypeAny(methodType)) {
|
|
82748
82746
|
return noCache ? anyIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, anyIterationTypes);
|
|
82749
82747
|
}
|
|
82750
|
-
const
|
|
82751
|
-
|
|
82748
|
+
const allSignatures = methodType ? getSignaturesOfType(methodType, 0 /* Call */) : void 0;
|
|
82749
|
+
const validSignatures = filter(allSignatures, (sig) => getMinArgumentCount(sig) === 0);
|
|
82750
|
+
if (!some(validSignatures)) {
|
|
82751
|
+
if (errorNode && some(allSignatures)) {
|
|
82752
|
+
checkTypeAssignableTo(
|
|
82753
|
+
type,
|
|
82754
|
+
resolver.getGlobalIterableType(
|
|
82755
|
+
/*reportErrors*/
|
|
82756
|
+
true
|
|
82757
|
+
),
|
|
82758
|
+
errorNode,
|
|
82759
|
+
/*headMessage*/
|
|
82760
|
+
void 0,
|
|
82761
|
+
/*containingMessageChain*/
|
|
82762
|
+
void 0,
|
|
82763
|
+
errorOutputContainer
|
|
82764
|
+
);
|
|
82765
|
+
}
|
|
82752
82766
|
return noCache ? noIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, noIterationTypes);
|
|
82753
82767
|
}
|
|
82754
|
-
const iteratorType = getIntersectionType(map(
|
|
82768
|
+
const iteratorType = getIntersectionType(map(validSignatures, getReturnTypeOfSignature));
|
|
82755
82769
|
const iterationTypes = getIterationTypesOfIteratorWorker(iteratorType, resolver, errorNode, errorOutputContainer, noCache) ?? noIterationTypes;
|
|
82756
82770
|
return noCache ? iterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, iterationTypes);
|
|
82757
82771
|
}
|
|
@@ -116770,15 +116784,88 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
116770
116784
|
return false;
|
|
116771
116785
|
}
|
|
116772
116786
|
function parenthesizeExpressionForNoAsi(node) {
|
|
116773
|
-
if (!commentsDisabled
|
|
116774
|
-
|
|
116775
|
-
|
|
116776
|
-
|
|
116777
|
-
|
|
116778
|
-
|
|
116779
|
-
|
|
116787
|
+
if (!commentsDisabled) {
|
|
116788
|
+
switch (node.kind) {
|
|
116789
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
116790
|
+
if (willEmitLeadingNewLine(node)) {
|
|
116791
|
+
const parseNode = getParseTreeNode(node);
|
|
116792
|
+
if (parseNode && isParenthesizedExpression(parseNode)) {
|
|
116793
|
+
const parens = factory.createParenthesizedExpression(node.expression);
|
|
116794
|
+
setOriginalNode(parens, node);
|
|
116795
|
+
setTextRange(parens, parseNode);
|
|
116796
|
+
return parens;
|
|
116797
|
+
}
|
|
116798
|
+
return factory.createParenthesizedExpression(node);
|
|
116799
|
+
}
|
|
116800
|
+
return factory.updatePartiallyEmittedExpression(
|
|
116801
|
+
node,
|
|
116802
|
+
parenthesizeExpressionForNoAsi(node.expression)
|
|
116803
|
+
);
|
|
116804
|
+
case 211 /* PropertyAccessExpression */:
|
|
116805
|
+
return factory.updatePropertyAccessExpression(
|
|
116806
|
+
node,
|
|
116807
|
+
parenthesizeExpressionForNoAsi(node.expression),
|
|
116808
|
+
node.name
|
|
116809
|
+
);
|
|
116810
|
+
case 212 /* ElementAccessExpression */:
|
|
116811
|
+
return factory.updateElementAccessExpression(
|
|
116812
|
+
node,
|
|
116813
|
+
parenthesizeExpressionForNoAsi(node.expression),
|
|
116814
|
+
node.argumentExpression
|
|
116815
|
+
);
|
|
116816
|
+
case 213 /* CallExpression */:
|
|
116817
|
+
return factory.updateCallExpression(
|
|
116818
|
+
node,
|
|
116819
|
+
parenthesizeExpressionForNoAsi(node.expression),
|
|
116820
|
+
node.typeArguments,
|
|
116821
|
+
node.arguments
|
|
116822
|
+
);
|
|
116823
|
+
case 215 /* TaggedTemplateExpression */:
|
|
116824
|
+
return factory.updateTaggedTemplateExpression(
|
|
116825
|
+
node,
|
|
116826
|
+
parenthesizeExpressionForNoAsi(node.tag),
|
|
116827
|
+
node.typeArguments,
|
|
116828
|
+
node.template
|
|
116829
|
+
);
|
|
116830
|
+
case 225 /* PostfixUnaryExpression */:
|
|
116831
|
+
return factory.updatePostfixUnaryExpression(
|
|
116832
|
+
node,
|
|
116833
|
+
parenthesizeExpressionForNoAsi(node.operand)
|
|
116834
|
+
);
|
|
116835
|
+
case 226 /* BinaryExpression */:
|
|
116836
|
+
return factory.updateBinaryExpression(
|
|
116837
|
+
node,
|
|
116838
|
+
parenthesizeExpressionForNoAsi(node.left),
|
|
116839
|
+
node.operatorToken,
|
|
116840
|
+
node.right
|
|
116841
|
+
);
|
|
116842
|
+
case 227 /* ConditionalExpression */:
|
|
116843
|
+
return factory.updateConditionalExpression(
|
|
116844
|
+
node,
|
|
116845
|
+
parenthesizeExpressionForNoAsi(node.condition),
|
|
116846
|
+
node.questionToken,
|
|
116847
|
+
node.whenTrue,
|
|
116848
|
+
node.colonToken,
|
|
116849
|
+
node.whenFalse
|
|
116850
|
+
);
|
|
116851
|
+
case 234 /* AsExpression */:
|
|
116852
|
+
return factory.updateAsExpression(
|
|
116853
|
+
node,
|
|
116854
|
+
parenthesizeExpressionForNoAsi(node.expression),
|
|
116855
|
+
node.type
|
|
116856
|
+
);
|
|
116857
|
+
case 238 /* SatisfiesExpression */:
|
|
116858
|
+
return factory.updateSatisfiesExpression(
|
|
116859
|
+
node,
|
|
116860
|
+
parenthesizeExpressionForNoAsi(node.expression),
|
|
116861
|
+
node.type
|
|
116862
|
+
);
|
|
116863
|
+
case 235 /* NonNullExpression */:
|
|
116864
|
+
return factory.updateNonNullExpression(
|
|
116865
|
+
node,
|
|
116866
|
+
parenthesizeExpressionForNoAsi(node.expression)
|
|
116867
|
+
);
|
|
116780
116868
|
}
|
|
116781
|
-
return factory.createParenthesizedExpression(node);
|
|
116782
116869
|
}
|
|
116783
116870
|
return node;
|
|
116784
116871
|
}
|
package/lib/typescript.js
CHANGED
|
@@ -2277,7 +2277,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2277
2277
|
|
|
2278
2278
|
// src/compiler/corePublic.ts
|
|
2279
2279
|
var versionMajorMinor = "5.7";
|
|
2280
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2280
|
+
var version = `${versionMajorMinor}.0-dev.20241024`;
|
|
2281
2281
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2282
2282
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2283
2283
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -49622,31 +49622,29 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
49622
49622
|
return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
|
|
49623
49623
|
}
|
|
49624
49624
|
}
|
|
49625
|
-
|
|
49626
|
-
|
|
49627
|
-
|
|
49628
|
-
|
|
49629
|
-
|
|
49630
|
-
|
|
49631
|
-
|
|
49632
|
-
|
|
49633
|
-
|
|
49634
|
-
|
|
49635
|
-
|
|
49636
|
-
|
|
49637
|
-
|
|
49638
|
-
|
|
49639
|
-
|
|
49640
|
-
|
|
49641
|
-
|
|
49642
|
-
if (pathContainsNodeModules(local)) {
|
|
49643
|
-
relativeSpecifiers = append(relativeSpecifiers, local);
|
|
49644
|
-
} else {
|
|
49645
|
-
pathsSpecifiers = append(pathsSpecifiers, local);
|
|
49646
|
-
}
|
|
49647
|
-
} else if (forAutoImport || !importedFileIsInNodeModules || modulePath.isInNodeModules) {
|
|
49625
|
+
const local = getLocalModuleSpecifier(
|
|
49626
|
+
modulePath.path,
|
|
49627
|
+
info,
|
|
49628
|
+
compilerOptions,
|
|
49629
|
+
host,
|
|
49630
|
+
options.overrideImportMode || importingSourceFile.impliedNodeFormat,
|
|
49631
|
+
preferences,
|
|
49632
|
+
/*pathsOnly*/
|
|
49633
|
+
modulePath.isRedirect || !!specifier
|
|
49634
|
+
);
|
|
49635
|
+
if (!local || forAutoImport && isExcludedByRegex(local, preferences.excludeRegexes)) {
|
|
49636
|
+
continue;
|
|
49637
|
+
}
|
|
49638
|
+
if (modulePath.isRedirect) {
|
|
49639
|
+
redirectPathsSpecifiers = append(redirectPathsSpecifiers, local);
|
|
49640
|
+
} else if (pathIsBareSpecifier(local)) {
|
|
49641
|
+
if (pathContainsNodeModules(local)) {
|
|
49648
49642
|
relativeSpecifiers = append(relativeSpecifiers, local);
|
|
49643
|
+
} else {
|
|
49644
|
+
pathsSpecifiers = append(pathsSpecifiers, local);
|
|
49649
49645
|
}
|
|
49646
|
+
} else if (forAutoImport || !importedFileIsInNodeModules || modulePath.isInNodeModules) {
|
|
49647
|
+
relativeSpecifiers = append(relativeSpecifiers, local);
|
|
49650
49648
|
}
|
|
49651
49649
|
}
|
|
49652
49650
|
return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? { kind: "paths", moduleSpecifiers: pathsSpecifiers, computedWithoutCache: true } : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? { kind: "redirect", moduleSpecifiers: redirectPathsSpecifiers, computedWithoutCache: true } : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true } : { kind: "relative", moduleSpecifiers: relativeSpecifiers ?? emptyArray, computedWithoutCache: true };
|
|
@@ -55942,7 +55940,7 @@ function createTypeChecker(host) {
|
|
|
55942
55940
|
const signatures = getSignaturesOfType(filterType(propertyType, (t) => !(t.flags & 32768 /* Undefined */)), 0 /* Call */);
|
|
55943
55941
|
for (const signature of signatures) {
|
|
55944
55942
|
const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 173 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
|
|
55945
|
-
typeElements.push(preserveCommentsOn(methodDeclaration));
|
|
55943
|
+
typeElements.push(preserveCommentsOn(methodDeclaration, signature.declaration || propertySymbol.valueDeclaration));
|
|
55946
55944
|
}
|
|
55947
55945
|
if (signatures.length || !optionalToken) {
|
|
55948
55946
|
return;
|
|
@@ -55977,8 +55975,8 @@ function createTypeChecker(host) {
|
|
|
55977
55975
|
optionalToken,
|
|
55978
55976
|
propertyTypeNode
|
|
55979
55977
|
);
|
|
55980
|
-
typeElements.push(preserveCommentsOn(propertySignature));
|
|
55981
|
-
function preserveCommentsOn(node) {
|
|
55978
|
+
typeElements.push(preserveCommentsOn(propertySignature, propertySymbol.valueDeclaration));
|
|
55979
|
+
function preserveCommentsOn(node, range) {
|
|
55982
55980
|
var _a2;
|
|
55983
55981
|
const jsdocPropertyTag = (_a2 = propertySymbol.declarations) == null ? void 0 : _a2.find((d) => d.kind === 348 /* JSDocPropertyTag */);
|
|
55984
55982
|
if (jsdocPropertyTag) {
|
|
@@ -55986,8 +55984,8 @@ function createTypeChecker(host) {
|
|
|
55986
55984
|
if (commentText) {
|
|
55987
55985
|
setSyntheticLeadingComments(node, [{ kind: 3 /* MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]);
|
|
55988
55986
|
}
|
|
55989
|
-
} else if (
|
|
55990
|
-
setCommentRange2(context, node,
|
|
55987
|
+
} else if (range) {
|
|
55988
|
+
setCommentRange2(context, node, range);
|
|
55991
55989
|
}
|
|
55992
55990
|
return node;
|
|
55993
55991
|
}
|
|
@@ -87175,7 +87173,7 @@ function createTypeChecker(host) {
|
|
|
87175
87173
|
return anyIterationTypes;
|
|
87176
87174
|
}
|
|
87177
87175
|
if (!(type.flags & 1048576 /* Union */)) {
|
|
87178
|
-
const errorOutputContainer = errorNode ? { errors: void 0 } : void 0;
|
|
87176
|
+
const errorOutputContainer = errorNode ? { errors: void 0, skipLogging: true } : void 0;
|
|
87179
87177
|
const iterationTypes2 = getIterationTypesOfIterableWorker(type, use, errorNode, errorOutputContainer);
|
|
87180
87178
|
if (iterationTypes2 === noIterationTypes) {
|
|
87181
87179
|
if (errorNode) {
|
|
@@ -87343,11 +87341,27 @@ function createTypeChecker(host) {
|
|
|
87343
87341
|
if (isTypeAny(methodType)) {
|
|
87344
87342
|
return noCache ? anyIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, anyIterationTypes);
|
|
87345
87343
|
}
|
|
87346
|
-
const
|
|
87347
|
-
|
|
87344
|
+
const allSignatures = methodType ? getSignaturesOfType(methodType, 0 /* Call */) : void 0;
|
|
87345
|
+
const validSignatures = filter(allSignatures, (sig) => getMinArgumentCount(sig) === 0);
|
|
87346
|
+
if (!some(validSignatures)) {
|
|
87347
|
+
if (errorNode && some(allSignatures)) {
|
|
87348
|
+
checkTypeAssignableTo(
|
|
87349
|
+
type,
|
|
87350
|
+
resolver.getGlobalIterableType(
|
|
87351
|
+
/*reportErrors*/
|
|
87352
|
+
true
|
|
87353
|
+
),
|
|
87354
|
+
errorNode,
|
|
87355
|
+
/*headMessage*/
|
|
87356
|
+
void 0,
|
|
87357
|
+
/*containingMessageChain*/
|
|
87358
|
+
void 0,
|
|
87359
|
+
errorOutputContainer
|
|
87360
|
+
);
|
|
87361
|
+
}
|
|
87348
87362
|
return noCache ? noIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, noIterationTypes);
|
|
87349
87363
|
}
|
|
87350
|
-
const iteratorType = getIntersectionType(map(
|
|
87364
|
+
const iteratorType = getIntersectionType(map(validSignatures, getReturnTypeOfSignature));
|
|
87351
87365
|
const iterationTypes = getIterationTypesOfIteratorWorker(iteratorType, resolver, errorNode, errorOutputContainer, noCache) ?? noIterationTypes;
|
|
87352
87366
|
return noCache ? iterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, iterationTypes);
|
|
87353
87367
|
}
|
|
@@ -121559,15 +121573,88 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
121559
121573
|
return false;
|
|
121560
121574
|
}
|
|
121561
121575
|
function parenthesizeExpressionForNoAsi(node) {
|
|
121562
|
-
if (!commentsDisabled
|
|
121563
|
-
|
|
121564
|
-
|
|
121565
|
-
|
|
121566
|
-
|
|
121567
|
-
|
|
121568
|
-
|
|
121576
|
+
if (!commentsDisabled) {
|
|
121577
|
+
switch (node.kind) {
|
|
121578
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
121579
|
+
if (willEmitLeadingNewLine(node)) {
|
|
121580
|
+
const parseNode = getParseTreeNode(node);
|
|
121581
|
+
if (parseNode && isParenthesizedExpression(parseNode)) {
|
|
121582
|
+
const parens = factory.createParenthesizedExpression(node.expression);
|
|
121583
|
+
setOriginalNode(parens, node);
|
|
121584
|
+
setTextRange(parens, parseNode);
|
|
121585
|
+
return parens;
|
|
121586
|
+
}
|
|
121587
|
+
return factory.createParenthesizedExpression(node);
|
|
121588
|
+
}
|
|
121589
|
+
return factory.updatePartiallyEmittedExpression(
|
|
121590
|
+
node,
|
|
121591
|
+
parenthesizeExpressionForNoAsi(node.expression)
|
|
121592
|
+
);
|
|
121593
|
+
case 211 /* PropertyAccessExpression */:
|
|
121594
|
+
return factory.updatePropertyAccessExpression(
|
|
121595
|
+
node,
|
|
121596
|
+
parenthesizeExpressionForNoAsi(node.expression),
|
|
121597
|
+
node.name
|
|
121598
|
+
);
|
|
121599
|
+
case 212 /* ElementAccessExpression */:
|
|
121600
|
+
return factory.updateElementAccessExpression(
|
|
121601
|
+
node,
|
|
121602
|
+
parenthesizeExpressionForNoAsi(node.expression),
|
|
121603
|
+
node.argumentExpression
|
|
121604
|
+
);
|
|
121605
|
+
case 213 /* CallExpression */:
|
|
121606
|
+
return factory.updateCallExpression(
|
|
121607
|
+
node,
|
|
121608
|
+
parenthesizeExpressionForNoAsi(node.expression),
|
|
121609
|
+
node.typeArguments,
|
|
121610
|
+
node.arguments
|
|
121611
|
+
);
|
|
121612
|
+
case 215 /* TaggedTemplateExpression */:
|
|
121613
|
+
return factory.updateTaggedTemplateExpression(
|
|
121614
|
+
node,
|
|
121615
|
+
parenthesizeExpressionForNoAsi(node.tag),
|
|
121616
|
+
node.typeArguments,
|
|
121617
|
+
node.template
|
|
121618
|
+
);
|
|
121619
|
+
case 225 /* PostfixUnaryExpression */:
|
|
121620
|
+
return factory.updatePostfixUnaryExpression(
|
|
121621
|
+
node,
|
|
121622
|
+
parenthesizeExpressionForNoAsi(node.operand)
|
|
121623
|
+
);
|
|
121624
|
+
case 226 /* BinaryExpression */:
|
|
121625
|
+
return factory.updateBinaryExpression(
|
|
121626
|
+
node,
|
|
121627
|
+
parenthesizeExpressionForNoAsi(node.left),
|
|
121628
|
+
node.operatorToken,
|
|
121629
|
+
node.right
|
|
121630
|
+
);
|
|
121631
|
+
case 227 /* ConditionalExpression */:
|
|
121632
|
+
return factory.updateConditionalExpression(
|
|
121633
|
+
node,
|
|
121634
|
+
parenthesizeExpressionForNoAsi(node.condition),
|
|
121635
|
+
node.questionToken,
|
|
121636
|
+
node.whenTrue,
|
|
121637
|
+
node.colonToken,
|
|
121638
|
+
node.whenFalse
|
|
121639
|
+
);
|
|
121640
|
+
case 234 /* AsExpression */:
|
|
121641
|
+
return factory.updateAsExpression(
|
|
121642
|
+
node,
|
|
121643
|
+
parenthesizeExpressionForNoAsi(node.expression),
|
|
121644
|
+
node.type
|
|
121645
|
+
);
|
|
121646
|
+
case 238 /* SatisfiesExpression */:
|
|
121647
|
+
return factory.updateSatisfiesExpression(
|
|
121648
|
+
node,
|
|
121649
|
+
parenthesizeExpressionForNoAsi(node.expression),
|
|
121650
|
+
node.type
|
|
121651
|
+
);
|
|
121652
|
+
case 235 /* NonNullExpression */:
|
|
121653
|
+
return factory.updateNonNullExpression(
|
|
121654
|
+
node,
|
|
121655
|
+
parenthesizeExpressionForNoAsi(node.expression)
|
|
121656
|
+
);
|
|
121569
121657
|
}
|
|
121570
|
-
return factory.createParenthesizedExpression(node);
|
|
121571
121658
|
}
|
|
121572
121659
|
return node;
|
|
121573
121660
|
}
|
|
@@ -140407,7 +140494,13 @@ function getDefaultLikeExportNameFromDeclaration(symbol) {
|
|
|
140407
140494
|
if (isExportSpecifier(d) && d.symbol.flags === 2097152 /* Alias */) {
|
|
140408
140495
|
return (_b = tryCast(d.propertyName, isIdentifier)) == null ? void 0 : _b.text;
|
|
140409
140496
|
}
|
|
140410
|
-
|
|
140497
|
+
const name = (_c = tryCast(getNameOfDeclaration(d), isIdentifier)) == null ? void 0 : _c.text;
|
|
140498
|
+
if (name) {
|
|
140499
|
+
return name;
|
|
140500
|
+
}
|
|
140501
|
+
if (symbol.parent && !isExternalModuleSymbol(symbol.parent)) {
|
|
140502
|
+
return symbol.parent.getName();
|
|
140503
|
+
}
|
|
140411
140504
|
});
|
|
140412
140505
|
}
|
|
140413
140506
|
function getSymbolParentOrFail(symbol) {
|
|
@@ -159289,7 +159382,7 @@ registerCodeFix({
|
|
|
159289
159382
|
}
|
|
159290
159383
|
});
|
|
159291
159384
|
function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
|
|
159292
|
-
var _a;
|
|
159385
|
+
var _a, _b, _c;
|
|
159293
159386
|
const token = getTokenAtPosition(sourceFile, tokenPos);
|
|
159294
159387
|
const parent2 = token.parent;
|
|
159295
159388
|
if (errorCode === Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code) {
|
|
@@ -159302,7 +159395,7 @@ function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
|
|
|
159302
159395
|
if (!(param && isParameter(param) && isIdentifier(param.name))) return void 0;
|
|
159303
159396
|
const properties = arrayFrom(checker.getUnmatchedProperties(
|
|
159304
159397
|
checker.getTypeAtLocation(parent2),
|
|
159305
|
-
checker.getParameterType(signature, argIndex),
|
|
159398
|
+
checker.getParameterType(signature, argIndex).getNonNullableType(),
|
|
159306
159399
|
/*requireOptionalProperties*/
|
|
159307
159400
|
false,
|
|
159308
159401
|
/*matchDiscriminantProperties*/
|
|
@@ -159312,7 +159405,7 @@ function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
|
|
|
159312
159405
|
return { kind: 3 /* ObjectLiteral */, token: param.name, identifier: param.name.text, properties, parentDeclaration: parent2 };
|
|
159313
159406
|
}
|
|
159314
159407
|
if (token.kind === 19 /* OpenBraceToken */ && isObjectLiteralExpression(parent2)) {
|
|
159315
|
-
const targetType = checker.getContextualType(parent2) || checker.getTypeAtLocation(parent2);
|
|
159408
|
+
const targetType = (_a = checker.getContextualType(parent2) || checker.getTypeAtLocation(parent2)) == null ? void 0 : _a.getNonNullableType();
|
|
159316
159409
|
const properties = arrayFrom(checker.getUnmatchedProperties(
|
|
159317
159410
|
checker.getTypeAtLocation(parent2),
|
|
159318
159411
|
targetType,
|
|
@@ -159327,7 +159420,7 @@ function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
|
|
|
159327
159420
|
}
|
|
159328
159421
|
if (!isMemberName(token)) return void 0;
|
|
159329
159422
|
if (isIdentifier(token) && hasInitializer(parent2) && parent2.initializer && isObjectLiteralExpression(parent2.initializer)) {
|
|
159330
|
-
const targetType = checker.getContextualType(token) || checker.getTypeAtLocation(token);
|
|
159423
|
+
const targetType = (_b = checker.getContextualType(token) || checker.getTypeAtLocation(token)) == null ? void 0 : _b.getNonNullableType();
|
|
159331
159424
|
const properties = arrayFrom(checker.getUnmatchedProperties(
|
|
159332
159425
|
checker.getTypeAtLocation(parent2.initializer),
|
|
159333
159426
|
targetType,
|
|
@@ -159346,7 +159439,7 @@ function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
|
|
|
159346
159439
|
return { kind: 4 /* JsxAttributes */, token, attributes, parentDeclaration: token.parent };
|
|
159347
159440
|
}
|
|
159348
159441
|
if (isIdentifier(token)) {
|
|
159349
|
-
const type = (
|
|
159442
|
+
const type = (_c = checker.getContextualType(token)) == null ? void 0 : _c.getNonNullableType();
|
|
159350
159443
|
if (type && getObjectFlags(type) & 16 /* Anonymous */) {
|
|
159351
159444
|
const signature = firstOrUndefined(checker.getSignaturesOfType(type, 0 /* Call */));
|
|
159352
159445
|
if (signature === void 0) return void 0;
|
|
@@ -179607,6 +179700,9 @@ function isSemicolonDeletionContext(context) {
|
|
|
179607
179700
|
if (startLine === endLine) {
|
|
179608
179701
|
return nextTokenKind === 20 /* CloseBraceToken */ || nextTokenKind === 1 /* EndOfFileToken */;
|
|
179609
179702
|
}
|
|
179703
|
+
if (nextTokenKind === 27 /* SemicolonToken */ && context.currentTokenSpan.kind === 27 /* SemicolonToken */) {
|
|
179704
|
+
return true;
|
|
179705
|
+
}
|
|
179610
179706
|
if (nextTokenKind === 240 /* SemicolonClassElement */ || nextTokenKind === 27 /* SemicolonToken */) {
|
|
179611
179707
|
return false;
|
|
179612
179708
|
}
|
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.7.0-dev.
|
|
5
|
+
"version": "5.7.0-dev.20241024",
|
|
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": "2ac4cb78d6930302eb0a55d07f154a2b0597ae32"
|
|
120
120
|
}
|