@typescript-deploys/pr-build 5.3.0-pr-55779-6 → 5.3.0-pr-52972-6
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 +28 -8
- package/lib/tsserver.js +341 -19
- package/lib/typescript.js +342 -20
- package/lib/typingsInstaller.js +9 -2
- 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.3";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20230920`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -16423,7 +16423,7 @@ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
|
|
|
16423
16423
|
return optionsHaveChanges(oldOptions, newOptions, affectsDeclarationPathOptionDeclarations);
|
|
16424
16424
|
}
|
|
16425
16425
|
function getCompilerOptionValue(options, option) {
|
|
16426
|
-
return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
|
|
16426
|
+
return option.strictFlag ? getStrictOptionValue(options, option.name) : option.allowJsFlag ? getAllowJSCompilerOption(options) : options[option.name];
|
|
16427
16427
|
}
|
|
16428
16428
|
function getJSXTransformEnabled(options) {
|
|
16429
16429
|
const jsx = options.jsx;
|
|
@@ -34183,7 +34183,8 @@ var commandOptionsWithoutBuild = [
|
|
|
34183
34183
|
{
|
|
34184
34184
|
name: "allowJs",
|
|
34185
34185
|
type: "boolean",
|
|
34186
|
-
|
|
34186
|
+
allowJsFlag: true,
|
|
34187
|
+
affectsBuildInfo: true,
|
|
34187
34188
|
showInSimplifiedHelpView: true,
|
|
34188
34189
|
category: Diagnostics.JavaScript_Support,
|
|
34189
34190
|
description: Diagnostics.Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these_files,
|
|
@@ -34193,6 +34194,8 @@ var commandOptionsWithoutBuild = [
|
|
|
34193
34194
|
name: "checkJs",
|
|
34194
34195
|
type: "boolean",
|
|
34195
34196
|
affectsModuleResolution: true,
|
|
34197
|
+
affectsSemanticDiagnostics: true,
|
|
34198
|
+
affectsBuildInfo: true,
|
|
34196
34199
|
showInSimplifiedHelpView: true,
|
|
34197
34200
|
category: Diagnostics.JavaScript_Support,
|
|
34198
34201
|
description: Diagnostics.Enable_error_reporting_in_type_checked_JavaScript_files,
|
|
@@ -34205,6 +34208,10 @@ var commandOptionsWithoutBuild = [
|
|
|
34205
34208
|
affectsEmit: true,
|
|
34206
34209
|
affectsBuildInfo: true,
|
|
34207
34210
|
affectsModuleResolution: true,
|
|
34211
|
+
// The checker emits an error when it sees JSX but this option is not set in compilerOptions.
|
|
34212
|
+
// This is effectively a semantic error, so mark this option as affecting semantic diagnostics
|
|
34213
|
+
// so we know to refresh errors when this option is changed.
|
|
34214
|
+
affectsSemanticDiagnostics: true,
|
|
34208
34215
|
paramType: Diagnostics.KIND,
|
|
34209
34216
|
showInSimplifiedHelpView: true,
|
|
34210
34217
|
category: Diagnostics.Language_and_Environment,
|
|
@@ -39922,7 +39929,7 @@ function createBinder() {
|
|
|
39922
39929
|
case 36 /* ExclamationEqualsToken */:
|
|
39923
39930
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
39924
39931
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
39925
|
-
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);
|
|
39932
|
+
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right) || (isBooleanLiteral(expr.right) && isNarrowingExpression(expr.left) || isBooleanLiteral(expr.left) && isNarrowingExpression(expr.right));
|
|
39926
39933
|
case 104 /* InstanceOfKeyword */:
|
|
39927
39934
|
return isNarrowableOperand(expr.left);
|
|
39928
39935
|
case 103 /* InKeyword */:
|
|
@@ -64053,10 +64060,13 @@ function createTypeChecker(host) {
|
|
|
64053
64060
|
if (sourceNameType && targetNameType)
|
|
64054
64061
|
inferFromTypes(sourceNameType, targetNameType);
|
|
64055
64062
|
}
|
|
64056
|
-
if (getObjectFlags(target) & 32 /* Mapped */
|
|
64057
|
-
const
|
|
64058
|
-
if (
|
|
64059
|
-
|
|
64063
|
+
if (getObjectFlags(target) & 32 /* Mapped */) {
|
|
64064
|
+
const mappedType = target;
|
|
64065
|
+
if (!getNameTypeFromMappedType(mappedType) || isFilteringMappedType(mappedType)) {
|
|
64066
|
+
const constraintType = getConstraintTypeFromMappedType(mappedType);
|
|
64067
|
+
if (inferToMappedType(source, mappedType, constraintType)) {
|
|
64068
|
+
return;
|
|
64069
|
+
}
|
|
64060
64070
|
}
|
|
64061
64071
|
}
|
|
64062
64072
|
if (!typesDefinitelyUnrelated(source, target)) {
|
|
@@ -65807,6 +65817,10 @@ function createTypeChecker(host) {
|
|
|
65807
65817
|
}
|
|
65808
65818
|
return type;
|
|
65809
65819
|
}
|
|
65820
|
+
function narrowTypeByBooleanComparison(type, expr, bool, operator, assumeTrue) {
|
|
65821
|
+
assumeTrue = assumeTrue !== (bool.kind === 112 /* TrueKeyword */) !== (operator !== 38 /* ExclamationEqualsEqualsToken */ && operator !== 36 /* ExclamationEqualsToken */);
|
|
65822
|
+
return narrowType(type, expr, assumeTrue);
|
|
65823
|
+
}
|
|
65810
65824
|
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
|
|
65811
65825
|
switch (expr.operatorToken.kind) {
|
|
65812
65826
|
case 64 /* EqualsToken */:
|
|
@@ -65854,6 +65868,12 @@ function createTypeChecker(host) {
|
|
|
65854
65868
|
if (isMatchingConstructorReference(right)) {
|
|
65855
65869
|
return narrowTypeByConstructor(type, operator, left, assumeTrue);
|
|
65856
65870
|
}
|
|
65871
|
+
if (isBooleanLiteral(right)) {
|
|
65872
|
+
return narrowTypeByBooleanComparison(type, left, right, operator, assumeTrue);
|
|
65873
|
+
}
|
|
65874
|
+
if (isBooleanLiteral(left)) {
|
|
65875
|
+
return narrowTypeByBooleanComparison(type, right, left, operator, assumeTrue);
|
|
65876
|
+
}
|
|
65857
65877
|
break;
|
|
65858
65878
|
case 104 /* InstanceOfKeyword */:
|
|
65859
65879
|
return narrowTypeByInstanceof(type, expr, assumeTrue);
|
package/lib/tsserver.js
CHANGED
|
@@ -2328,7 +2328,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2328
2328
|
|
|
2329
2329
|
// src/compiler/corePublic.ts
|
|
2330
2330
|
var versionMajorMinor = "5.3";
|
|
2331
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2331
|
+
var version = `${versionMajorMinor}.0-insiders.20230920`;
|
|
2332
2332
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2333
2333
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2334
2334
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -20572,7 +20572,7 @@ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
|
|
|
20572
20572
|
return optionsHaveChanges(oldOptions, newOptions, affectsDeclarationPathOptionDeclarations);
|
|
20573
20573
|
}
|
|
20574
20574
|
function getCompilerOptionValue(options, option) {
|
|
20575
|
-
return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
|
|
20575
|
+
return option.strictFlag ? getStrictOptionValue(options, option.name) : option.allowJsFlag ? getAllowJSCompilerOption(options) : options[option.name];
|
|
20576
20576
|
}
|
|
20577
20577
|
function getJSXTransformEnabled(options) {
|
|
20578
20578
|
const jsx = options.jsx;
|
|
@@ -38577,7 +38577,8 @@ var commandOptionsWithoutBuild = [
|
|
|
38577
38577
|
{
|
|
38578
38578
|
name: "allowJs",
|
|
38579
38579
|
type: "boolean",
|
|
38580
|
-
|
|
38580
|
+
allowJsFlag: true,
|
|
38581
|
+
affectsBuildInfo: true,
|
|
38581
38582
|
showInSimplifiedHelpView: true,
|
|
38582
38583
|
category: Diagnostics.JavaScript_Support,
|
|
38583
38584
|
description: Diagnostics.Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these_files,
|
|
@@ -38587,6 +38588,8 @@ var commandOptionsWithoutBuild = [
|
|
|
38587
38588
|
name: "checkJs",
|
|
38588
38589
|
type: "boolean",
|
|
38589
38590
|
affectsModuleResolution: true,
|
|
38591
|
+
affectsSemanticDiagnostics: true,
|
|
38592
|
+
affectsBuildInfo: true,
|
|
38590
38593
|
showInSimplifiedHelpView: true,
|
|
38591
38594
|
category: Diagnostics.JavaScript_Support,
|
|
38592
38595
|
description: Diagnostics.Enable_error_reporting_in_type_checked_JavaScript_files,
|
|
@@ -38599,6 +38602,10 @@ var commandOptionsWithoutBuild = [
|
|
|
38599
38602
|
affectsEmit: true,
|
|
38600
38603
|
affectsBuildInfo: true,
|
|
38601
38604
|
affectsModuleResolution: true,
|
|
38605
|
+
// The checker emits an error when it sees JSX but this option is not set in compilerOptions.
|
|
38606
|
+
// This is effectively a semantic error, so mark this option as affecting semantic diagnostics
|
|
38607
|
+
// so we know to refresh errors when this option is changed.
|
|
38608
|
+
affectsSemanticDiagnostics: true,
|
|
38602
38609
|
paramType: Diagnostics.KIND,
|
|
38603
38610
|
showInSimplifiedHelpView: true,
|
|
38604
38611
|
category: Diagnostics.Language_and_Environment,
|
|
@@ -44577,7 +44584,7 @@ function createBinder() {
|
|
|
44577
44584
|
case 36 /* ExclamationEqualsToken */:
|
|
44578
44585
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
44579
44586
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
44580
|
-
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);
|
|
44587
|
+
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right) || (isBooleanLiteral(expr.right) && isNarrowingExpression(expr.left) || isBooleanLiteral(expr.left) && isNarrowingExpression(expr.right));
|
|
44581
44588
|
case 104 /* InstanceOfKeyword */:
|
|
44582
44589
|
return isNarrowableOperand(expr.left);
|
|
44583
44590
|
case 103 /* InKeyword */:
|
|
@@ -68753,10 +68760,13 @@ function createTypeChecker(host) {
|
|
|
68753
68760
|
if (sourceNameType && targetNameType)
|
|
68754
68761
|
inferFromTypes(sourceNameType, targetNameType);
|
|
68755
68762
|
}
|
|
68756
|
-
if (getObjectFlags(target) & 32 /* Mapped */
|
|
68757
|
-
const
|
|
68758
|
-
if (
|
|
68759
|
-
|
|
68763
|
+
if (getObjectFlags(target) & 32 /* Mapped */) {
|
|
68764
|
+
const mappedType = target;
|
|
68765
|
+
if (!getNameTypeFromMappedType(mappedType) || isFilteringMappedType(mappedType)) {
|
|
68766
|
+
const constraintType = getConstraintTypeFromMappedType(mappedType);
|
|
68767
|
+
if (inferToMappedType(source, mappedType, constraintType)) {
|
|
68768
|
+
return;
|
|
68769
|
+
}
|
|
68760
68770
|
}
|
|
68761
68771
|
}
|
|
68762
68772
|
if (!typesDefinitelyUnrelated(source, target)) {
|
|
@@ -70507,6 +70517,10 @@ function createTypeChecker(host) {
|
|
|
70507
70517
|
}
|
|
70508
70518
|
return type;
|
|
70509
70519
|
}
|
|
70520
|
+
function narrowTypeByBooleanComparison(type, expr, bool, operator, assumeTrue) {
|
|
70521
|
+
assumeTrue = assumeTrue !== (bool.kind === 112 /* TrueKeyword */) !== (operator !== 38 /* ExclamationEqualsEqualsToken */ && operator !== 36 /* ExclamationEqualsToken */);
|
|
70522
|
+
return narrowType(type, expr, assumeTrue);
|
|
70523
|
+
}
|
|
70510
70524
|
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
|
|
70511
70525
|
switch (expr.operatorToken.kind) {
|
|
70512
70526
|
case 64 /* EqualsToken */:
|
|
@@ -70554,6 +70568,12 @@ function createTypeChecker(host) {
|
|
|
70554
70568
|
if (isMatchingConstructorReference(right)) {
|
|
70555
70569
|
return narrowTypeByConstructor(type, operator, left, assumeTrue);
|
|
70556
70570
|
}
|
|
70571
|
+
if (isBooleanLiteral(right)) {
|
|
70572
|
+
return narrowTypeByBooleanComparison(type, left, right, operator, assumeTrue);
|
|
70573
|
+
}
|
|
70574
|
+
if (isBooleanLiteral(left)) {
|
|
70575
|
+
return narrowTypeByBooleanComparison(type, right, left, operator, assumeTrue);
|
|
70576
|
+
}
|
|
70557
70577
|
break;
|
|
70558
70578
|
case 104 /* InstanceOfKeyword */:
|
|
70559
70579
|
return narrowTypeByInstanceof(type, expr, assumeTrue);
|
|
@@ -164863,7 +164883,6 @@ __export(ts_InlayHints_exports, {
|
|
|
164863
164883
|
});
|
|
164864
164884
|
|
|
164865
164885
|
// src/services/inlayHints.ts
|
|
164866
|
-
var maxTypeHintLength = 30;
|
|
164867
164886
|
var leadingParameterNameCommentRegexFactory = (name) => {
|
|
164868
164887
|
return new RegExp(`^\\s?/\\*\\*?\\s?${name}\\s?\\*\\/\\s?$`);
|
|
164869
164888
|
};
|
|
@@ -164943,9 +164962,10 @@ function provideInlayHints(context) {
|
|
|
164943
164962
|
displayParts
|
|
164944
164963
|
});
|
|
164945
164964
|
}
|
|
164946
|
-
function addTypeHints(
|
|
164965
|
+
function addTypeHints(hintText, position) {
|
|
164947
164966
|
result.push({
|
|
164948
|
-
text:
|
|
164967
|
+
text: typeof hintText === "string" ? `: ${hintText}` : "",
|
|
164968
|
+
displayParts: typeof hintText === "string" ? void 0 : [{ text: ": " }, ...hintText],
|
|
164949
164969
|
position,
|
|
164950
164970
|
kind: "Type" /* Type */,
|
|
164951
164971
|
whitespaceBefore: true
|
|
@@ -164983,13 +165003,14 @@ function provideInlayHints(context) {
|
|
|
164983
165003
|
if (isModuleReferenceType(declarationType)) {
|
|
164984
165004
|
return;
|
|
164985
165005
|
}
|
|
164986
|
-
const
|
|
164987
|
-
if (
|
|
164988
|
-
const
|
|
165006
|
+
const hints = typeToInlayHintParts(declarationType);
|
|
165007
|
+
if (hints) {
|
|
165008
|
+
const hintText = typeof hints === "string" ? hints : hints.map((part) => part.text).join("");
|
|
165009
|
+
const isVariableNameMatchesType = preferences.includeInlayVariableTypeHintsWhenTypeMatchesName === false && equateStringsCaseInsensitive(decl.name.getText(), hintText);
|
|
164989
165010
|
if (isVariableNameMatchesType) {
|
|
164990
165011
|
return;
|
|
164991
165012
|
}
|
|
164992
|
-
addTypeHints(
|
|
165013
|
+
addTypeHints(hints, decl.name.end);
|
|
164993
165014
|
}
|
|
164994
165015
|
}
|
|
164995
165016
|
function visitCallOrNewExpression(expr) {
|
|
@@ -165097,11 +165118,10 @@ function provideInlayHints(context) {
|
|
|
165097
165118
|
if (isModuleReferenceType(returnType)) {
|
|
165098
165119
|
return;
|
|
165099
165120
|
}
|
|
165100
|
-
const
|
|
165101
|
-
if (
|
|
165102
|
-
|
|
165121
|
+
const hint = typeToInlayHintParts(returnType);
|
|
165122
|
+
if (hint) {
|
|
165123
|
+
addTypeHints(hint, getTypeAnnotationPosition(decl));
|
|
165103
165124
|
}
|
|
165104
|
-
addTypeHints(typeDisplayString, getTypeAnnotationPosition(decl));
|
|
165105
165125
|
}
|
|
165106
165126
|
function getTypeAnnotationPosition(decl) {
|
|
165107
165127
|
const closeParenToken = findChildOfKind(decl, 22 /* CloseParenToken */, file);
|
|
@@ -165162,6 +165182,303 @@ function provideInlayHints(context) {
|
|
|
165162
165182
|
);
|
|
165163
165183
|
});
|
|
165164
165184
|
}
|
|
165185
|
+
function typeToInlayHintParts(type) {
|
|
165186
|
+
if (!shouldUseInteractiveInlayHints(preferences)) {
|
|
165187
|
+
return printTypeInSingleLine(type);
|
|
165188
|
+
}
|
|
165189
|
+
const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
|
|
165190
|
+
const typeNode = checker.typeToTypeNode(
|
|
165191
|
+
type,
|
|
165192
|
+
/*enclosingDeclaration*/
|
|
165193
|
+
void 0,
|
|
165194
|
+
flags
|
|
165195
|
+
);
|
|
165196
|
+
Debug.assertIsDefined(typeNode, "should always get typenode");
|
|
165197
|
+
const parts = [];
|
|
165198
|
+
visitForDisplayParts(typeNode);
|
|
165199
|
+
return parts;
|
|
165200
|
+
function visitForDisplayParts(node) {
|
|
165201
|
+
if (!node) {
|
|
165202
|
+
return;
|
|
165203
|
+
}
|
|
165204
|
+
const tokenString = tokenToString(node.kind);
|
|
165205
|
+
if (tokenString) {
|
|
165206
|
+
parts.push({ text: tokenString });
|
|
165207
|
+
return;
|
|
165208
|
+
}
|
|
165209
|
+
switch (node.kind) {
|
|
165210
|
+
case 80 /* Identifier */:
|
|
165211
|
+
const identifier = node;
|
|
165212
|
+
const identifierText = idText(identifier);
|
|
165213
|
+
const name = identifier.symbol && identifier.symbol.declarations && identifier.symbol.declarations.length && getNameOfDeclaration(identifier.symbol.declarations[0]);
|
|
165214
|
+
if (name) {
|
|
165215
|
+
parts.push(getNodeDisplayPart(identifierText, name));
|
|
165216
|
+
} else {
|
|
165217
|
+
parts.push({ text: identifierText });
|
|
165218
|
+
}
|
|
165219
|
+
break;
|
|
165220
|
+
case 9 /* NumericLiteral */:
|
|
165221
|
+
parts.push({ text: node.text });
|
|
165222
|
+
break;
|
|
165223
|
+
case 11 /* StringLiteral */:
|
|
165224
|
+
parts.push({ text: `"${node.text}"` });
|
|
165225
|
+
break;
|
|
165226
|
+
case 166 /* QualifiedName */:
|
|
165227
|
+
const qualifiedName = node;
|
|
165228
|
+
visitForDisplayParts(qualifiedName.left);
|
|
165229
|
+
parts.push({ text: "." });
|
|
165230
|
+
visitForDisplayParts(qualifiedName.right);
|
|
165231
|
+
break;
|
|
165232
|
+
case 182 /* TypePredicate */:
|
|
165233
|
+
const predicate = node;
|
|
165234
|
+
if (predicate.assertsModifier) {
|
|
165235
|
+
parts.push({ text: "asserts " });
|
|
165236
|
+
}
|
|
165237
|
+
visitForDisplayParts(predicate.parameterName);
|
|
165238
|
+
if (predicate.type) {
|
|
165239
|
+
parts.push({ text: " is " });
|
|
165240
|
+
visitForDisplayParts(predicate.type);
|
|
165241
|
+
}
|
|
165242
|
+
break;
|
|
165243
|
+
case 183 /* TypeReference */:
|
|
165244
|
+
const typeReference = node;
|
|
165245
|
+
visitForDisplayParts(typeReference.typeName);
|
|
165246
|
+
if (typeReference.typeArguments) {
|
|
165247
|
+
parts.push({ text: "<" });
|
|
165248
|
+
visitDisplayPartList(typeReference.typeArguments, ", ");
|
|
165249
|
+
parts.push({ text: ">" });
|
|
165250
|
+
}
|
|
165251
|
+
break;
|
|
165252
|
+
case 168 /* TypeParameter */:
|
|
165253
|
+
const typeParameter = node;
|
|
165254
|
+
if (typeParameter.modifiers) {
|
|
165255
|
+
visitDisplayPartList(typeParameter.modifiers, " ");
|
|
165256
|
+
}
|
|
165257
|
+
visitForDisplayParts(typeParameter.name);
|
|
165258
|
+
if (typeParameter.constraint) {
|
|
165259
|
+
parts.push({ text: " extends " });
|
|
165260
|
+
visitForDisplayParts(typeParameter.constraint);
|
|
165261
|
+
}
|
|
165262
|
+
if (typeParameter.default) {
|
|
165263
|
+
parts.push({ text: " = " });
|
|
165264
|
+
visitForDisplayParts(typeParameter.default);
|
|
165265
|
+
}
|
|
165266
|
+
break;
|
|
165267
|
+
case 169 /* Parameter */:
|
|
165268
|
+
const parameter = node;
|
|
165269
|
+
if (parameter.modifiers) {
|
|
165270
|
+
visitDisplayPartList(parameter.modifiers, " ");
|
|
165271
|
+
}
|
|
165272
|
+
if (parameter.dotDotDotToken) {
|
|
165273
|
+
parts.push({ text: "..." });
|
|
165274
|
+
}
|
|
165275
|
+
visitForDisplayParts(parameter.name);
|
|
165276
|
+
if (parameter.questionToken) {
|
|
165277
|
+
parts.push({ text: "?" });
|
|
165278
|
+
}
|
|
165279
|
+
if (parameter.type) {
|
|
165280
|
+
parts.push({ text: ": " });
|
|
165281
|
+
visitForDisplayParts(parameter.type);
|
|
165282
|
+
}
|
|
165283
|
+
break;
|
|
165284
|
+
case 185 /* ConstructorType */:
|
|
165285
|
+
const constructorType = node;
|
|
165286
|
+
parts.push({ text: "new " });
|
|
165287
|
+
if (constructorType.typeParameters) {
|
|
165288
|
+
parts.push({ text: "<" });
|
|
165289
|
+
visitDisplayPartList(constructorType.typeParameters, ", ");
|
|
165290
|
+
parts.push({ text: ">" });
|
|
165291
|
+
}
|
|
165292
|
+
parts.push({ text: "(" });
|
|
165293
|
+
visitDisplayPartList(constructorType.parameters, ", ");
|
|
165294
|
+
parts.push({ text: ")" });
|
|
165295
|
+
parts.push({ text: " => " });
|
|
165296
|
+
visitForDisplayParts(constructorType.type);
|
|
165297
|
+
break;
|
|
165298
|
+
case 186 /* TypeQuery */:
|
|
165299
|
+
const typeQuery = node;
|
|
165300
|
+
parts.push({ text: "typeof " });
|
|
165301
|
+
visitForDisplayParts(typeQuery.exprName);
|
|
165302
|
+
if (typeQuery.typeArguments) {
|
|
165303
|
+
parts.push({ text: "<" });
|
|
165304
|
+
visitDisplayPartList(typeQuery.typeArguments, ", ");
|
|
165305
|
+
parts.push({ text: ">" });
|
|
165306
|
+
}
|
|
165307
|
+
break;
|
|
165308
|
+
case 187 /* TypeLiteral */:
|
|
165309
|
+
const typeLiteral = node;
|
|
165310
|
+
parts.push({ text: "{" });
|
|
165311
|
+
if (typeLiteral.members.length) {
|
|
165312
|
+
parts.push({ text: " " });
|
|
165313
|
+
visitDisplayPartList(typeLiteral.members, "; ");
|
|
165314
|
+
parts.push({ text: " " });
|
|
165315
|
+
}
|
|
165316
|
+
parts.push({ text: "}" });
|
|
165317
|
+
break;
|
|
165318
|
+
case 188 /* ArrayType */:
|
|
165319
|
+
visitForDisplayParts(node.elementType);
|
|
165320
|
+
parts.push({ text: "[]" });
|
|
165321
|
+
break;
|
|
165322
|
+
case 189 /* TupleType */:
|
|
165323
|
+
parts.push({ text: "[" });
|
|
165324
|
+
visitDisplayPartList(node.elements, ", ");
|
|
165325
|
+
parts.push({ text: "]" });
|
|
165326
|
+
break;
|
|
165327
|
+
case 202 /* NamedTupleMember */:
|
|
165328
|
+
const member = node;
|
|
165329
|
+
if (member.dotDotDotToken) {
|
|
165330
|
+
parts.push({ text: "..." });
|
|
165331
|
+
}
|
|
165332
|
+
visitForDisplayParts(member.name);
|
|
165333
|
+
if (member.questionToken) {
|
|
165334
|
+
parts.push({ text: "?" });
|
|
165335
|
+
}
|
|
165336
|
+
parts.push({ text: ": " });
|
|
165337
|
+
visitForDisplayParts(member.type);
|
|
165338
|
+
break;
|
|
165339
|
+
case 190 /* OptionalType */:
|
|
165340
|
+
visitForDisplayParts(node.type);
|
|
165341
|
+
parts.push({ text: "?" });
|
|
165342
|
+
break;
|
|
165343
|
+
case 191 /* RestType */:
|
|
165344
|
+
parts.push({ text: "..." });
|
|
165345
|
+
visitForDisplayParts(node.type);
|
|
165346
|
+
break;
|
|
165347
|
+
case 192 /* UnionType */:
|
|
165348
|
+
visitDisplayPartList(node.types, " | ");
|
|
165349
|
+
break;
|
|
165350
|
+
case 193 /* IntersectionType */:
|
|
165351
|
+
visitDisplayPartList(node.types, " & ");
|
|
165352
|
+
break;
|
|
165353
|
+
case 194 /* ConditionalType */:
|
|
165354
|
+
const conditionalType = node;
|
|
165355
|
+
visitForDisplayParts(conditionalType.checkType);
|
|
165356
|
+
parts.push({ text: " extends " });
|
|
165357
|
+
visitForDisplayParts(conditionalType.extendsType);
|
|
165358
|
+
parts.push({ text: " ? " });
|
|
165359
|
+
visitForDisplayParts(conditionalType.trueType);
|
|
165360
|
+
parts.push({ text: " : " });
|
|
165361
|
+
visitForDisplayParts(conditionalType.falseType);
|
|
165362
|
+
break;
|
|
165363
|
+
case 195 /* InferType */:
|
|
165364
|
+
parts.push({ text: "infer " });
|
|
165365
|
+
visitForDisplayParts(node.typeParameter);
|
|
165366
|
+
break;
|
|
165367
|
+
case 196 /* ParenthesizedType */:
|
|
165368
|
+
parts.push({ text: "(" });
|
|
165369
|
+
visitForDisplayParts(node.type);
|
|
165370
|
+
parts.push({ text: ")" });
|
|
165371
|
+
break;
|
|
165372
|
+
case 198 /* TypeOperator */:
|
|
165373
|
+
const typeOperator = node;
|
|
165374
|
+
parts.push({ text: `${tokenToString(typeOperator.operator)} ` });
|
|
165375
|
+
visitForDisplayParts(typeOperator.type);
|
|
165376
|
+
break;
|
|
165377
|
+
case 199 /* IndexedAccessType */:
|
|
165378
|
+
const indexedAccess = node;
|
|
165379
|
+
visitForDisplayParts(indexedAccess.objectType);
|
|
165380
|
+
parts.push({ text: "[" });
|
|
165381
|
+
visitForDisplayParts(indexedAccess.indexType);
|
|
165382
|
+
parts.push({ text: "]" });
|
|
165383
|
+
break;
|
|
165384
|
+
case 200 /* MappedType */:
|
|
165385
|
+
const mappedType = node;
|
|
165386
|
+
parts.push({ text: "{ " });
|
|
165387
|
+
if (mappedType.readonlyToken) {
|
|
165388
|
+
if (mappedType.readonlyToken.kind === 40 /* PlusToken */) {
|
|
165389
|
+
parts.push({ text: "+" });
|
|
165390
|
+
} else if (mappedType.readonlyToken.kind === 41 /* MinusToken */) {
|
|
165391
|
+
parts.push({ text: "-" });
|
|
165392
|
+
}
|
|
165393
|
+
parts.push({ text: "readonly " });
|
|
165394
|
+
}
|
|
165395
|
+
parts.push({ text: "[" });
|
|
165396
|
+
visitForDisplayParts(mappedType.typeParameter);
|
|
165397
|
+
if (mappedType.nameType) {
|
|
165398
|
+
parts.push({ text: " as " });
|
|
165399
|
+
visitForDisplayParts(mappedType.nameType);
|
|
165400
|
+
}
|
|
165401
|
+
parts.push({ text: "]" });
|
|
165402
|
+
if (mappedType.questionToken) {
|
|
165403
|
+
if (mappedType.questionToken.kind === 40 /* PlusToken */) {
|
|
165404
|
+
parts.push({ text: "+" });
|
|
165405
|
+
} else if (mappedType.questionToken.kind === 41 /* MinusToken */) {
|
|
165406
|
+
parts.push({ text: "-" });
|
|
165407
|
+
}
|
|
165408
|
+
parts.push({ text: "?" });
|
|
165409
|
+
}
|
|
165410
|
+
parts.push({ text: ": " });
|
|
165411
|
+
if (mappedType.type) {
|
|
165412
|
+
visitForDisplayParts(mappedType.type);
|
|
165413
|
+
}
|
|
165414
|
+
parts.push({ text: "; }" });
|
|
165415
|
+
break;
|
|
165416
|
+
case 201 /* LiteralType */:
|
|
165417
|
+
visitForDisplayParts(node.literal);
|
|
165418
|
+
break;
|
|
165419
|
+
case 184 /* FunctionType */:
|
|
165420
|
+
const functionType = node;
|
|
165421
|
+
if (functionType.typeParameters) {
|
|
165422
|
+
parts.push({ text: "<" });
|
|
165423
|
+
visitDisplayPartList(functionType.typeParameters, ", ");
|
|
165424
|
+
parts.push({ text: ">" });
|
|
165425
|
+
}
|
|
165426
|
+
parts.push({ text: "(" });
|
|
165427
|
+
visitDisplayPartList(functionType.parameters, ", ");
|
|
165428
|
+
parts.push({ text: ")" });
|
|
165429
|
+
parts.push({ text: " => " });
|
|
165430
|
+
visitForDisplayParts(functionType.type);
|
|
165431
|
+
break;
|
|
165432
|
+
case 205 /* ImportType */:
|
|
165433
|
+
const importType = node;
|
|
165434
|
+
if (importType.isTypeOf) {
|
|
165435
|
+
parts.push({ text: "typeof " });
|
|
165436
|
+
}
|
|
165437
|
+
parts.push({ text: "import(" });
|
|
165438
|
+
visitForDisplayParts(importType.argument);
|
|
165439
|
+
if (importType.assertions) {
|
|
165440
|
+
parts.push({ text: ", { assert: " });
|
|
165441
|
+
visitDisplayPartList(importType.assertions.assertClause.elements, ", ");
|
|
165442
|
+
parts.push({ text: " }" });
|
|
165443
|
+
}
|
|
165444
|
+
parts.push({ text: ")" });
|
|
165445
|
+
if (importType.qualifier) {
|
|
165446
|
+
parts.push({ text: "." });
|
|
165447
|
+
visitForDisplayParts(importType.qualifier);
|
|
165448
|
+
}
|
|
165449
|
+
if (importType.typeArguments) {
|
|
165450
|
+
parts.push({ text: "<" });
|
|
165451
|
+
visitDisplayPartList(importType.typeArguments, ", ");
|
|
165452
|
+
parts.push({ text: ">" });
|
|
165453
|
+
}
|
|
165454
|
+
break;
|
|
165455
|
+
case 171 /* PropertySignature */:
|
|
165456
|
+
const propertySignature = node;
|
|
165457
|
+
if (propertySignature.modifiers) {
|
|
165458
|
+
visitDisplayPartList(propertySignature.modifiers, " ");
|
|
165459
|
+
}
|
|
165460
|
+
visitForDisplayParts(propertySignature.name);
|
|
165461
|
+
if (propertySignature.questionToken) {
|
|
165462
|
+
parts.push({ text: "?" });
|
|
165463
|
+
}
|
|
165464
|
+
if (propertySignature.type) {
|
|
165465
|
+
parts.push({ text: ": " });
|
|
165466
|
+
visitForDisplayParts(propertySignature.type);
|
|
165467
|
+
}
|
|
165468
|
+
break;
|
|
165469
|
+
default:
|
|
165470
|
+
Debug.failBadSyntaxKind(node);
|
|
165471
|
+
}
|
|
165472
|
+
}
|
|
165473
|
+
function visitDisplayPartList(nodes, separator) {
|
|
165474
|
+
nodes.forEach((node, index) => {
|
|
165475
|
+
if (index > 0) {
|
|
165476
|
+
parts.push({ text: separator });
|
|
165477
|
+
}
|
|
165478
|
+
visitForDisplayParts(node);
|
|
165479
|
+
});
|
|
165480
|
+
}
|
|
165481
|
+
}
|
|
165165
165482
|
function isUndefined(name) {
|
|
165166
165483
|
return name === "undefined";
|
|
165167
165484
|
}
|
|
@@ -165327,6 +165644,11 @@ function getJsDocTagsFromDeclarations(declarations, checker) {
|
|
|
165327
165644
|
}
|
|
165328
165645
|
for (const tag of tags) {
|
|
165329
165646
|
infos.push({ name: tag.tagName.text, text: getCommentDisplayParts(tag, checker) });
|
|
165647
|
+
if (isJSDocPropertyLikeTag(tag) && tag.isNameFirst && tag.typeExpression && isJSDocTypeLiteral(tag.typeExpression.type)) {
|
|
165648
|
+
forEach(tag.typeExpression.type.jsDocPropertyTags, (propTag) => {
|
|
165649
|
+
infos.push({ name: propTag.tagName.text, text: getCommentDisplayParts(propTag, checker) });
|
|
165650
|
+
});
|
|
165651
|
+
}
|
|
165330
165652
|
}
|
|
165331
165653
|
});
|
|
165332
165654
|
return infos;
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.3";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230920`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -17860,7 +17860,7 @@ ${lanes.join("\n")}
|
|
|
17860
17860
|
return optionsHaveChanges(oldOptions, newOptions, affectsDeclarationPathOptionDeclarations);
|
|
17861
17861
|
}
|
|
17862
17862
|
function getCompilerOptionValue(options, option) {
|
|
17863
|
-
return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
|
|
17863
|
+
return option.strictFlag ? getStrictOptionValue(options, option.name) : option.allowJsFlag ? getAllowJSCompilerOption(options) : options[option.name];
|
|
17864
17864
|
}
|
|
17865
17865
|
function getJSXTransformEnabled(options) {
|
|
17866
17866
|
const jsx = options.jsx;
|
|
@@ -38060,7 +38060,8 @@ ${lanes.join("\n")}
|
|
|
38060
38060
|
{
|
|
38061
38061
|
name: "allowJs",
|
|
38062
38062
|
type: "boolean",
|
|
38063
|
-
|
|
38063
|
+
allowJsFlag: true,
|
|
38064
|
+
affectsBuildInfo: true,
|
|
38064
38065
|
showInSimplifiedHelpView: true,
|
|
38065
38066
|
category: Diagnostics.JavaScript_Support,
|
|
38066
38067
|
description: Diagnostics.Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these_files,
|
|
@@ -38070,6 +38071,8 @@ ${lanes.join("\n")}
|
|
|
38070
38071
|
name: "checkJs",
|
|
38071
38072
|
type: "boolean",
|
|
38072
38073
|
affectsModuleResolution: true,
|
|
38074
|
+
affectsSemanticDiagnostics: true,
|
|
38075
|
+
affectsBuildInfo: true,
|
|
38073
38076
|
showInSimplifiedHelpView: true,
|
|
38074
38077
|
category: Diagnostics.JavaScript_Support,
|
|
38075
38078
|
description: Diagnostics.Enable_error_reporting_in_type_checked_JavaScript_files,
|
|
@@ -38082,6 +38085,10 @@ ${lanes.join("\n")}
|
|
|
38082
38085
|
affectsEmit: true,
|
|
38083
38086
|
affectsBuildInfo: true,
|
|
38084
38087
|
affectsModuleResolution: true,
|
|
38088
|
+
// The checker emits an error when it sees JSX but this option is not set in compilerOptions.
|
|
38089
|
+
// This is effectively a semantic error, so mark this option as affecting semantic diagnostics
|
|
38090
|
+
// so we know to refresh errors when this option is changed.
|
|
38091
|
+
affectsSemanticDiagnostics: true,
|
|
38085
38092
|
paramType: Diagnostics.KIND,
|
|
38086
38093
|
showInSimplifiedHelpView: true,
|
|
38087
38094
|
category: Diagnostics.Language_and_Environment,
|
|
@@ -42424,7 +42431,7 @@ ${lanes.join("\n")}
|
|
|
42424
42431
|
case 36 /* ExclamationEqualsToken */:
|
|
42425
42432
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
42426
42433
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
42427
|
-
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);
|
|
42434
|
+
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right) || (isBooleanLiteral(expr.right) && isNarrowingExpression(expr.left) || isBooleanLiteral(expr.left) && isNarrowingExpression(expr.right));
|
|
42428
42435
|
case 104 /* InstanceOfKeyword */:
|
|
42429
42436
|
return isNarrowableOperand(expr.left);
|
|
42430
42437
|
case 103 /* InKeyword */:
|
|
@@ -66519,10 +66526,13 @@ ${lanes.join("\n")}
|
|
|
66519
66526
|
if (sourceNameType && targetNameType)
|
|
66520
66527
|
inferFromTypes(sourceNameType, targetNameType);
|
|
66521
66528
|
}
|
|
66522
|
-
if (getObjectFlags(target) & 32 /* Mapped */
|
|
66523
|
-
const
|
|
66524
|
-
if (
|
|
66525
|
-
|
|
66529
|
+
if (getObjectFlags(target) & 32 /* Mapped */) {
|
|
66530
|
+
const mappedType = target;
|
|
66531
|
+
if (!getNameTypeFromMappedType(mappedType) || isFilteringMappedType(mappedType)) {
|
|
66532
|
+
const constraintType = getConstraintTypeFromMappedType(mappedType);
|
|
66533
|
+
if (inferToMappedType(source, mappedType, constraintType)) {
|
|
66534
|
+
return;
|
|
66535
|
+
}
|
|
66526
66536
|
}
|
|
66527
66537
|
}
|
|
66528
66538
|
if (!typesDefinitelyUnrelated(source, target)) {
|
|
@@ -68273,6 +68283,10 @@ ${lanes.join("\n")}
|
|
|
68273
68283
|
}
|
|
68274
68284
|
return type;
|
|
68275
68285
|
}
|
|
68286
|
+
function narrowTypeByBooleanComparison(type, expr, bool, operator, assumeTrue) {
|
|
68287
|
+
assumeTrue = assumeTrue !== (bool.kind === 112 /* TrueKeyword */) !== (operator !== 38 /* ExclamationEqualsEqualsToken */ && operator !== 36 /* ExclamationEqualsToken */);
|
|
68288
|
+
return narrowType(type, expr, assumeTrue);
|
|
68289
|
+
}
|
|
68276
68290
|
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
|
|
68277
68291
|
switch (expr.operatorToken.kind) {
|
|
68278
68292
|
case 64 /* EqualsToken */:
|
|
@@ -68320,6 +68334,12 @@ ${lanes.join("\n")}
|
|
|
68320
68334
|
if (isMatchingConstructorReference(right)) {
|
|
68321
68335
|
return narrowTypeByConstructor(type, operator, left, assumeTrue);
|
|
68322
68336
|
}
|
|
68337
|
+
if (isBooleanLiteral(right)) {
|
|
68338
|
+
return narrowTypeByBooleanComparison(type, left, right, operator, assumeTrue);
|
|
68339
|
+
}
|
|
68340
|
+
if (isBooleanLiteral(left)) {
|
|
68341
|
+
return narrowTypeByBooleanComparison(type, right, left, operator, assumeTrue);
|
|
68342
|
+
}
|
|
68323
68343
|
break;
|
|
68324
68344
|
case 104 /* InstanceOfKeyword */:
|
|
68325
68345
|
return narrowTypeByInstanceof(type, expr, assumeTrue);
|
|
@@ -164294,9 +164314,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164294
164314
|
displayParts
|
|
164295
164315
|
});
|
|
164296
164316
|
}
|
|
164297
|
-
function addTypeHints(
|
|
164317
|
+
function addTypeHints(hintText, position) {
|
|
164298
164318
|
result.push({
|
|
164299
|
-
text:
|
|
164319
|
+
text: typeof hintText === "string" ? `: ${hintText}` : "",
|
|
164320
|
+
displayParts: typeof hintText === "string" ? void 0 : [{ text: ": " }, ...hintText],
|
|
164300
164321
|
position,
|
|
164301
164322
|
kind: "Type" /* Type */,
|
|
164302
164323
|
whitespaceBefore: true
|
|
@@ -164334,13 +164355,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164334
164355
|
if (isModuleReferenceType(declarationType)) {
|
|
164335
164356
|
return;
|
|
164336
164357
|
}
|
|
164337
|
-
const
|
|
164338
|
-
if (
|
|
164339
|
-
const
|
|
164358
|
+
const hints = typeToInlayHintParts(declarationType);
|
|
164359
|
+
if (hints) {
|
|
164360
|
+
const hintText = typeof hints === "string" ? hints : hints.map((part) => part.text).join("");
|
|
164361
|
+
const isVariableNameMatchesType = preferences.includeInlayVariableTypeHintsWhenTypeMatchesName === false && equateStringsCaseInsensitive(decl.name.getText(), hintText);
|
|
164340
164362
|
if (isVariableNameMatchesType) {
|
|
164341
164363
|
return;
|
|
164342
164364
|
}
|
|
164343
|
-
addTypeHints(
|
|
164365
|
+
addTypeHints(hints, decl.name.end);
|
|
164344
164366
|
}
|
|
164345
164367
|
}
|
|
164346
164368
|
function visitCallOrNewExpression(expr) {
|
|
@@ -164448,11 +164470,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164448
164470
|
if (isModuleReferenceType(returnType)) {
|
|
164449
164471
|
return;
|
|
164450
164472
|
}
|
|
164451
|
-
const
|
|
164452
|
-
if (
|
|
164453
|
-
|
|
164473
|
+
const hint = typeToInlayHintParts(returnType);
|
|
164474
|
+
if (hint) {
|
|
164475
|
+
addTypeHints(hint, getTypeAnnotationPosition(decl));
|
|
164454
164476
|
}
|
|
164455
|
-
addTypeHints(typeDisplayString, getTypeAnnotationPosition(decl));
|
|
164456
164477
|
}
|
|
164457
164478
|
function getTypeAnnotationPosition(decl) {
|
|
164458
164479
|
const closeParenToken = findChildOfKind(decl, 22 /* CloseParenToken */, file);
|
|
@@ -164513,6 +164534,303 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164513
164534
|
);
|
|
164514
164535
|
});
|
|
164515
164536
|
}
|
|
164537
|
+
function typeToInlayHintParts(type) {
|
|
164538
|
+
if (!shouldUseInteractiveInlayHints(preferences)) {
|
|
164539
|
+
return printTypeInSingleLine(type);
|
|
164540
|
+
}
|
|
164541
|
+
const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
|
|
164542
|
+
const typeNode = checker.typeToTypeNode(
|
|
164543
|
+
type,
|
|
164544
|
+
/*enclosingDeclaration*/
|
|
164545
|
+
void 0,
|
|
164546
|
+
flags
|
|
164547
|
+
);
|
|
164548
|
+
Debug.assertIsDefined(typeNode, "should always get typenode");
|
|
164549
|
+
const parts = [];
|
|
164550
|
+
visitForDisplayParts(typeNode);
|
|
164551
|
+
return parts;
|
|
164552
|
+
function visitForDisplayParts(node) {
|
|
164553
|
+
if (!node) {
|
|
164554
|
+
return;
|
|
164555
|
+
}
|
|
164556
|
+
const tokenString = tokenToString(node.kind);
|
|
164557
|
+
if (tokenString) {
|
|
164558
|
+
parts.push({ text: tokenString });
|
|
164559
|
+
return;
|
|
164560
|
+
}
|
|
164561
|
+
switch (node.kind) {
|
|
164562
|
+
case 80 /* Identifier */:
|
|
164563
|
+
const identifier = node;
|
|
164564
|
+
const identifierText = idText(identifier);
|
|
164565
|
+
const name = identifier.symbol && identifier.symbol.declarations && identifier.symbol.declarations.length && getNameOfDeclaration(identifier.symbol.declarations[0]);
|
|
164566
|
+
if (name) {
|
|
164567
|
+
parts.push(getNodeDisplayPart(identifierText, name));
|
|
164568
|
+
} else {
|
|
164569
|
+
parts.push({ text: identifierText });
|
|
164570
|
+
}
|
|
164571
|
+
break;
|
|
164572
|
+
case 9 /* NumericLiteral */:
|
|
164573
|
+
parts.push({ text: node.text });
|
|
164574
|
+
break;
|
|
164575
|
+
case 11 /* StringLiteral */:
|
|
164576
|
+
parts.push({ text: `"${node.text}"` });
|
|
164577
|
+
break;
|
|
164578
|
+
case 166 /* QualifiedName */:
|
|
164579
|
+
const qualifiedName = node;
|
|
164580
|
+
visitForDisplayParts(qualifiedName.left);
|
|
164581
|
+
parts.push({ text: "." });
|
|
164582
|
+
visitForDisplayParts(qualifiedName.right);
|
|
164583
|
+
break;
|
|
164584
|
+
case 182 /* TypePredicate */:
|
|
164585
|
+
const predicate = node;
|
|
164586
|
+
if (predicate.assertsModifier) {
|
|
164587
|
+
parts.push({ text: "asserts " });
|
|
164588
|
+
}
|
|
164589
|
+
visitForDisplayParts(predicate.parameterName);
|
|
164590
|
+
if (predicate.type) {
|
|
164591
|
+
parts.push({ text: " is " });
|
|
164592
|
+
visitForDisplayParts(predicate.type);
|
|
164593
|
+
}
|
|
164594
|
+
break;
|
|
164595
|
+
case 183 /* TypeReference */:
|
|
164596
|
+
const typeReference = node;
|
|
164597
|
+
visitForDisplayParts(typeReference.typeName);
|
|
164598
|
+
if (typeReference.typeArguments) {
|
|
164599
|
+
parts.push({ text: "<" });
|
|
164600
|
+
visitDisplayPartList(typeReference.typeArguments, ", ");
|
|
164601
|
+
parts.push({ text: ">" });
|
|
164602
|
+
}
|
|
164603
|
+
break;
|
|
164604
|
+
case 168 /* TypeParameter */:
|
|
164605
|
+
const typeParameter = node;
|
|
164606
|
+
if (typeParameter.modifiers) {
|
|
164607
|
+
visitDisplayPartList(typeParameter.modifiers, " ");
|
|
164608
|
+
}
|
|
164609
|
+
visitForDisplayParts(typeParameter.name);
|
|
164610
|
+
if (typeParameter.constraint) {
|
|
164611
|
+
parts.push({ text: " extends " });
|
|
164612
|
+
visitForDisplayParts(typeParameter.constraint);
|
|
164613
|
+
}
|
|
164614
|
+
if (typeParameter.default) {
|
|
164615
|
+
parts.push({ text: " = " });
|
|
164616
|
+
visitForDisplayParts(typeParameter.default);
|
|
164617
|
+
}
|
|
164618
|
+
break;
|
|
164619
|
+
case 169 /* Parameter */:
|
|
164620
|
+
const parameter = node;
|
|
164621
|
+
if (parameter.modifiers) {
|
|
164622
|
+
visitDisplayPartList(parameter.modifiers, " ");
|
|
164623
|
+
}
|
|
164624
|
+
if (parameter.dotDotDotToken) {
|
|
164625
|
+
parts.push({ text: "..." });
|
|
164626
|
+
}
|
|
164627
|
+
visitForDisplayParts(parameter.name);
|
|
164628
|
+
if (parameter.questionToken) {
|
|
164629
|
+
parts.push({ text: "?" });
|
|
164630
|
+
}
|
|
164631
|
+
if (parameter.type) {
|
|
164632
|
+
parts.push({ text: ": " });
|
|
164633
|
+
visitForDisplayParts(parameter.type);
|
|
164634
|
+
}
|
|
164635
|
+
break;
|
|
164636
|
+
case 185 /* ConstructorType */:
|
|
164637
|
+
const constructorType = node;
|
|
164638
|
+
parts.push({ text: "new " });
|
|
164639
|
+
if (constructorType.typeParameters) {
|
|
164640
|
+
parts.push({ text: "<" });
|
|
164641
|
+
visitDisplayPartList(constructorType.typeParameters, ", ");
|
|
164642
|
+
parts.push({ text: ">" });
|
|
164643
|
+
}
|
|
164644
|
+
parts.push({ text: "(" });
|
|
164645
|
+
visitDisplayPartList(constructorType.parameters, ", ");
|
|
164646
|
+
parts.push({ text: ")" });
|
|
164647
|
+
parts.push({ text: " => " });
|
|
164648
|
+
visitForDisplayParts(constructorType.type);
|
|
164649
|
+
break;
|
|
164650
|
+
case 186 /* TypeQuery */:
|
|
164651
|
+
const typeQuery = node;
|
|
164652
|
+
parts.push({ text: "typeof " });
|
|
164653
|
+
visitForDisplayParts(typeQuery.exprName);
|
|
164654
|
+
if (typeQuery.typeArguments) {
|
|
164655
|
+
parts.push({ text: "<" });
|
|
164656
|
+
visitDisplayPartList(typeQuery.typeArguments, ", ");
|
|
164657
|
+
parts.push({ text: ">" });
|
|
164658
|
+
}
|
|
164659
|
+
break;
|
|
164660
|
+
case 187 /* TypeLiteral */:
|
|
164661
|
+
const typeLiteral = node;
|
|
164662
|
+
parts.push({ text: "{" });
|
|
164663
|
+
if (typeLiteral.members.length) {
|
|
164664
|
+
parts.push({ text: " " });
|
|
164665
|
+
visitDisplayPartList(typeLiteral.members, "; ");
|
|
164666
|
+
parts.push({ text: " " });
|
|
164667
|
+
}
|
|
164668
|
+
parts.push({ text: "}" });
|
|
164669
|
+
break;
|
|
164670
|
+
case 188 /* ArrayType */:
|
|
164671
|
+
visitForDisplayParts(node.elementType);
|
|
164672
|
+
parts.push({ text: "[]" });
|
|
164673
|
+
break;
|
|
164674
|
+
case 189 /* TupleType */:
|
|
164675
|
+
parts.push({ text: "[" });
|
|
164676
|
+
visitDisplayPartList(node.elements, ", ");
|
|
164677
|
+
parts.push({ text: "]" });
|
|
164678
|
+
break;
|
|
164679
|
+
case 202 /* NamedTupleMember */:
|
|
164680
|
+
const member = node;
|
|
164681
|
+
if (member.dotDotDotToken) {
|
|
164682
|
+
parts.push({ text: "..." });
|
|
164683
|
+
}
|
|
164684
|
+
visitForDisplayParts(member.name);
|
|
164685
|
+
if (member.questionToken) {
|
|
164686
|
+
parts.push({ text: "?" });
|
|
164687
|
+
}
|
|
164688
|
+
parts.push({ text: ": " });
|
|
164689
|
+
visitForDisplayParts(member.type);
|
|
164690
|
+
break;
|
|
164691
|
+
case 190 /* OptionalType */:
|
|
164692
|
+
visitForDisplayParts(node.type);
|
|
164693
|
+
parts.push({ text: "?" });
|
|
164694
|
+
break;
|
|
164695
|
+
case 191 /* RestType */:
|
|
164696
|
+
parts.push({ text: "..." });
|
|
164697
|
+
visitForDisplayParts(node.type);
|
|
164698
|
+
break;
|
|
164699
|
+
case 192 /* UnionType */:
|
|
164700
|
+
visitDisplayPartList(node.types, " | ");
|
|
164701
|
+
break;
|
|
164702
|
+
case 193 /* IntersectionType */:
|
|
164703
|
+
visitDisplayPartList(node.types, " & ");
|
|
164704
|
+
break;
|
|
164705
|
+
case 194 /* ConditionalType */:
|
|
164706
|
+
const conditionalType = node;
|
|
164707
|
+
visitForDisplayParts(conditionalType.checkType);
|
|
164708
|
+
parts.push({ text: " extends " });
|
|
164709
|
+
visitForDisplayParts(conditionalType.extendsType);
|
|
164710
|
+
parts.push({ text: " ? " });
|
|
164711
|
+
visitForDisplayParts(conditionalType.trueType);
|
|
164712
|
+
parts.push({ text: " : " });
|
|
164713
|
+
visitForDisplayParts(conditionalType.falseType);
|
|
164714
|
+
break;
|
|
164715
|
+
case 195 /* InferType */:
|
|
164716
|
+
parts.push({ text: "infer " });
|
|
164717
|
+
visitForDisplayParts(node.typeParameter);
|
|
164718
|
+
break;
|
|
164719
|
+
case 196 /* ParenthesizedType */:
|
|
164720
|
+
parts.push({ text: "(" });
|
|
164721
|
+
visitForDisplayParts(node.type);
|
|
164722
|
+
parts.push({ text: ")" });
|
|
164723
|
+
break;
|
|
164724
|
+
case 198 /* TypeOperator */:
|
|
164725
|
+
const typeOperator = node;
|
|
164726
|
+
parts.push({ text: `${tokenToString(typeOperator.operator)} ` });
|
|
164727
|
+
visitForDisplayParts(typeOperator.type);
|
|
164728
|
+
break;
|
|
164729
|
+
case 199 /* IndexedAccessType */:
|
|
164730
|
+
const indexedAccess = node;
|
|
164731
|
+
visitForDisplayParts(indexedAccess.objectType);
|
|
164732
|
+
parts.push({ text: "[" });
|
|
164733
|
+
visitForDisplayParts(indexedAccess.indexType);
|
|
164734
|
+
parts.push({ text: "]" });
|
|
164735
|
+
break;
|
|
164736
|
+
case 200 /* MappedType */:
|
|
164737
|
+
const mappedType = node;
|
|
164738
|
+
parts.push({ text: "{ " });
|
|
164739
|
+
if (mappedType.readonlyToken) {
|
|
164740
|
+
if (mappedType.readonlyToken.kind === 40 /* PlusToken */) {
|
|
164741
|
+
parts.push({ text: "+" });
|
|
164742
|
+
} else if (mappedType.readonlyToken.kind === 41 /* MinusToken */) {
|
|
164743
|
+
parts.push({ text: "-" });
|
|
164744
|
+
}
|
|
164745
|
+
parts.push({ text: "readonly " });
|
|
164746
|
+
}
|
|
164747
|
+
parts.push({ text: "[" });
|
|
164748
|
+
visitForDisplayParts(mappedType.typeParameter);
|
|
164749
|
+
if (mappedType.nameType) {
|
|
164750
|
+
parts.push({ text: " as " });
|
|
164751
|
+
visitForDisplayParts(mappedType.nameType);
|
|
164752
|
+
}
|
|
164753
|
+
parts.push({ text: "]" });
|
|
164754
|
+
if (mappedType.questionToken) {
|
|
164755
|
+
if (mappedType.questionToken.kind === 40 /* PlusToken */) {
|
|
164756
|
+
parts.push({ text: "+" });
|
|
164757
|
+
} else if (mappedType.questionToken.kind === 41 /* MinusToken */) {
|
|
164758
|
+
parts.push({ text: "-" });
|
|
164759
|
+
}
|
|
164760
|
+
parts.push({ text: "?" });
|
|
164761
|
+
}
|
|
164762
|
+
parts.push({ text: ": " });
|
|
164763
|
+
if (mappedType.type) {
|
|
164764
|
+
visitForDisplayParts(mappedType.type);
|
|
164765
|
+
}
|
|
164766
|
+
parts.push({ text: "; }" });
|
|
164767
|
+
break;
|
|
164768
|
+
case 201 /* LiteralType */:
|
|
164769
|
+
visitForDisplayParts(node.literal);
|
|
164770
|
+
break;
|
|
164771
|
+
case 184 /* FunctionType */:
|
|
164772
|
+
const functionType = node;
|
|
164773
|
+
if (functionType.typeParameters) {
|
|
164774
|
+
parts.push({ text: "<" });
|
|
164775
|
+
visitDisplayPartList(functionType.typeParameters, ", ");
|
|
164776
|
+
parts.push({ text: ">" });
|
|
164777
|
+
}
|
|
164778
|
+
parts.push({ text: "(" });
|
|
164779
|
+
visitDisplayPartList(functionType.parameters, ", ");
|
|
164780
|
+
parts.push({ text: ")" });
|
|
164781
|
+
parts.push({ text: " => " });
|
|
164782
|
+
visitForDisplayParts(functionType.type);
|
|
164783
|
+
break;
|
|
164784
|
+
case 205 /* ImportType */:
|
|
164785
|
+
const importType = node;
|
|
164786
|
+
if (importType.isTypeOf) {
|
|
164787
|
+
parts.push({ text: "typeof " });
|
|
164788
|
+
}
|
|
164789
|
+
parts.push({ text: "import(" });
|
|
164790
|
+
visitForDisplayParts(importType.argument);
|
|
164791
|
+
if (importType.assertions) {
|
|
164792
|
+
parts.push({ text: ", { assert: " });
|
|
164793
|
+
visitDisplayPartList(importType.assertions.assertClause.elements, ", ");
|
|
164794
|
+
parts.push({ text: " }" });
|
|
164795
|
+
}
|
|
164796
|
+
parts.push({ text: ")" });
|
|
164797
|
+
if (importType.qualifier) {
|
|
164798
|
+
parts.push({ text: "." });
|
|
164799
|
+
visitForDisplayParts(importType.qualifier);
|
|
164800
|
+
}
|
|
164801
|
+
if (importType.typeArguments) {
|
|
164802
|
+
parts.push({ text: "<" });
|
|
164803
|
+
visitDisplayPartList(importType.typeArguments, ", ");
|
|
164804
|
+
parts.push({ text: ">" });
|
|
164805
|
+
}
|
|
164806
|
+
break;
|
|
164807
|
+
case 171 /* PropertySignature */:
|
|
164808
|
+
const propertySignature = node;
|
|
164809
|
+
if (propertySignature.modifiers) {
|
|
164810
|
+
visitDisplayPartList(propertySignature.modifiers, " ");
|
|
164811
|
+
}
|
|
164812
|
+
visitForDisplayParts(propertySignature.name);
|
|
164813
|
+
if (propertySignature.questionToken) {
|
|
164814
|
+
parts.push({ text: "?" });
|
|
164815
|
+
}
|
|
164816
|
+
if (propertySignature.type) {
|
|
164817
|
+
parts.push({ text: ": " });
|
|
164818
|
+
visitForDisplayParts(propertySignature.type);
|
|
164819
|
+
}
|
|
164820
|
+
break;
|
|
164821
|
+
default:
|
|
164822
|
+
Debug.failBadSyntaxKind(node);
|
|
164823
|
+
}
|
|
164824
|
+
}
|
|
164825
|
+
function visitDisplayPartList(nodes, separator) {
|
|
164826
|
+
nodes.forEach((node, index) => {
|
|
164827
|
+
if (index > 0) {
|
|
164828
|
+
parts.push({ text: separator });
|
|
164829
|
+
}
|
|
164830
|
+
visitForDisplayParts(node);
|
|
164831
|
+
});
|
|
164832
|
+
}
|
|
164833
|
+
}
|
|
164516
164834
|
function isUndefined(name) {
|
|
164517
164835
|
return name === "undefined";
|
|
164518
164836
|
}
|
|
@@ -164532,12 +164850,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164532
164850
|
};
|
|
164533
164851
|
}
|
|
164534
164852
|
}
|
|
164535
|
-
var
|
|
164853
|
+
var leadingParameterNameCommentRegexFactory;
|
|
164536
164854
|
var init_inlayHints = __esm({
|
|
164537
164855
|
"src/services/inlayHints.ts"() {
|
|
164538
164856
|
"use strict";
|
|
164539
164857
|
init_ts4();
|
|
164540
|
-
maxTypeHintLength = 30;
|
|
164541
164858
|
leadingParameterNameCommentRegexFactory = (name) => {
|
|
164542
164859
|
return new RegExp(`^\\s?/\\*\\*?\\s?${name}\\s?\\*\\/\\s?$`);
|
|
164543
164860
|
};
|
|
@@ -164600,6 +164917,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164600
164917
|
}
|
|
164601
164918
|
for (const tag of tags) {
|
|
164602
164919
|
infos.push({ name: tag.tagName.text, text: getCommentDisplayParts(tag, checker) });
|
|
164920
|
+
if (isJSDocPropertyLikeTag(tag) && tag.isNameFirst && tag.typeExpression && isJSDocTypeLiteral(tag.typeExpression.type)) {
|
|
164921
|
+
forEach(tag.typeExpression.type.jsDocPropertyTags, (propTag) => {
|
|
164922
|
+
infos.push({ name: propTag.tagName.text, text: getCommentDisplayParts(propTag, checker) });
|
|
164923
|
+
});
|
|
164924
|
+
}
|
|
164603
164925
|
}
|
|
164604
164926
|
});
|
|
164605
164927
|
return infos;
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.3";
|
|
57
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20230920`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -26005,7 +26005,8 @@ var commandOptionsWithoutBuild = [
|
|
|
26005
26005
|
{
|
|
26006
26006
|
name: "allowJs",
|
|
26007
26007
|
type: "boolean",
|
|
26008
|
-
|
|
26008
|
+
allowJsFlag: true,
|
|
26009
|
+
affectsBuildInfo: true,
|
|
26009
26010
|
showInSimplifiedHelpView: true,
|
|
26010
26011
|
category: Diagnostics.JavaScript_Support,
|
|
26011
26012
|
description: Diagnostics.Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these_files,
|
|
@@ -26015,6 +26016,8 @@ var commandOptionsWithoutBuild = [
|
|
|
26015
26016
|
name: "checkJs",
|
|
26016
26017
|
type: "boolean",
|
|
26017
26018
|
affectsModuleResolution: true,
|
|
26019
|
+
affectsSemanticDiagnostics: true,
|
|
26020
|
+
affectsBuildInfo: true,
|
|
26018
26021
|
showInSimplifiedHelpView: true,
|
|
26019
26022
|
category: Diagnostics.JavaScript_Support,
|
|
26020
26023
|
description: Diagnostics.Enable_error_reporting_in_type_checked_JavaScript_files,
|
|
@@ -26027,6 +26030,10 @@ var commandOptionsWithoutBuild = [
|
|
|
26027
26030
|
affectsEmit: true,
|
|
26028
26031
|
affectsBuildInfo: true,
|
|
26029
26032
|
affectsModuleResolution: true,
|
|
26033
|
+
// The checker emits an error when it sees JSX but this option is not set in compilerOptions.
|
|
26034
|
+
// This is effectively a semantic error, so mark this option as affecting semantic diagnostics
|
|
26035
|
+
// so we know to refresh errors when this option is changed.
|
|
26036
|
+
affectsSemanticDiagnostics: true,
|
|
26030
26037
|
paramType: Diagnostics.KIND,
|
|
26031
26038
|
showInSimplifiedHelpView: true,
|
|
26032
26039
|
category: Diagnostics.Language_and_Environment,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.3.0-pr-
|
|
5
|
+
"version": "5.3.0-pr-52972-6",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"node": "20.1.0",
|
|
115
115
|
"npm": "8.19.4"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "3be6be6c3b7f564f8a49926c47ce91e7db814b91"
|
|
118
118
|
}
|