typescript 5.5.0-dev.20240313 → 5.5.0-dev.20240314
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 +74 -4
- package/lib/tsserver.js +178 -85
- package/lib/typescript.js +178 -85
- package/lib/typingsInstaller.js +5 -1
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240314`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -6096,6 +6096,8 @@ var Diagnostics = {
|
|
|
6096
6096
|
The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration: diag(1494, 1 /* Error */, "The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration_1494", "The left-hand side of a 'for...in' statement cannot be an 'await using' declaration."),
|
|
6097
6097
|
_0_modifier_cannot_appear_on_an_await_using_declaration: diag(1495, 1 /* Error */, "_0_modifier_cannot_appear_on_an_await_using_declaration_1495", "'{0}' modifier cannot appear on an 'await using' declaration."),
|
|
6098
6098
|
Identifier_string_literal_or_number_literal_expected: diag(1496, 1 /* Error */, "Identifier_string_literal_or_number_literal_expected_1496", "Identifier, string literal, or number literal expected."),
|
|
6099
|
+
Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator: diag(1497, 1 /* Error */, "Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator_1497", "Expression must be enclosed in parentheses to be used as a decorator."),
|
|
6100
|
+
Invalid_syntax_in_decorator: diag(1498, 1 /* Error */, "Invalid_syntax_in_decorator_1498", "Invalid syntax in decorator."),
|
|
6099
6101
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
6100
6102
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
6101
6103
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -7747,6 +7749,8 @@ var Diagnostics = {
|
|
|
7747
7749
|
Add_optional_parameter_to_0: diag(95191, 3 /* Message */, "Add_optional_parameter_to_0_95191", "Add optional parameter to '{0}'"),
|
|
7748
7750
|
Add_optional_parameters_to_0: diag(95192, 3 /* Message */, "Add_optional_parameters_to_0_95192", "Add optional parameters to '{0}'"),
|
|
7749
7751
|
Add_all_optional_parameters: diag(95193, 3 /* Message */, "Add_all_optional_parameters_95193", "Add all optional parameters"),
|
|
7752
|
+
Wrap_in_parentheses: diag(95194, 3 /* Message */, "Wrap_in_parentheses_95194", "Wrap in parentheses"),
|
|
7753
|
+
Wrap_all_invalid_decorator_expressions_in_parentheses: diag(95195, 3 /* Message */, "Wrap_all_invalid_decorator_expressions_in_parentheses_95195", "Wrap all invalid decorator expressions in parentheses"),
|
|
7750
7754
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
7751
7755
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
7752
7756
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -17650,6 +17654,20 @@ function replaceFirstStar(s, replacement) {
|
|
|
17650
17654
|
function getNameFromImportAttribute(node) {
|
|
17651
17655
|
return isIdentifier(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text);
|
|
17652
17656
|
}
|
|
17657
|
+
function isSyntacticallyString(expr) {
|
|
17658
|
+
expr = skipOuterExpressions(expr);
|
|
17659
|
+
switch (expr.kind) {
|
|
17660
|
+
case 226 /* BinaryExpression */:
|
|
17661
|
+
const left = expr.left;
|
|
17662
|
+
const right = expr.right;
|
|
17663
|
+
return expr.operatorToken.kind === 40 /* PlusToken */ && (isSyntacticallyString(left) || isSyntacticallyString(right));
|
|
17664
|
+
case 228 /* TemplateExpression */:
|
|
17665
|
+
case 11 /* StringLiteral */:
|
|
17666
|
+
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
17667
|
+
return true;
|
|
17668
|
+
}
|
|
17669
|
+
return false;
|
|
17670
|
+
}
|
|
17653
17671
|
|
|
17654
17672
|
// src/compiler/factory/baseNodeFactory.ts
|
|
17655
17673
|
function createBaseNodeFactory() {
|
|
@@ -57591,7 +57609,7 @@ function createTypeChecker(host) {
|
|
|
57591
57609
|
const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
57592
57610
|
const typeVariable = typeSet[typeVarIndex];
|
|
57593
57611
|
const primitiveType = typeSet[1 - typeVarIndex];
|
|
57594
|
-
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) || includes & 16777216 /* IncludesEmptyObject */)) {
|
|
57612
|
+
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) && !isGenericStringLikeType(primitiveType) || includes & 16777216 /* IncludesEmptyObject */)) {
|
|
57595
57613
|
const constraint = getBaseConstraintOfType(typeVariable);
|
|
57596
57614
|
if (constraint && everyType(constraint, (t) => !!(t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) || isEmptyAnonymousObjectType(t))) {
|
|
57597
57615
|
if (isTypeStrictSubtypeOf(constraint, primitiveType)) {
|
|
@@ -58196,6 +58214,9 @@ function createTypeChecker(host) {
|
|
|
58196
58214
|
function isPatternLiteralType(type) {
|
|
58197
58215
|
return !!(type.flags & 134217728 /* TemplateLiteral */) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456 /* StringMapping */) && isPatternLiteralPlaceholderType(type.type);
|
|
58198
58216
|
}
|
|
58217
|
+
function isGenericStringLikeType(type) {
|
|
58218
|
+
return !!(type.flags & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) && !isPatternLiteralType(type);
|
|
58219
|
+
}
|
|
58199
58220
|
function isGenericType(type) {
|
|
58200
58221
|
return !!getGenericObjectFlags(type);
|
|
58201
58222
|
}
|
|
@@ -58218,7 +58239,7 @@ function createTypeChecker(host) {
|
|
|
58218
58239
|
}
|
|
58219
58240
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
58220
58241
|
}
|
|
58221
|
-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */
|
|
58242
|
+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */) || isGenericStringLikeType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
58222
58243
|
}
|
|
58223
58244
|
function getSimplifiedType(type, writing) {
|
|
58224
58245
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -77345,7 +77366,56 @@ function createTypeChecker(host) {
|
|
|
77345
77366
|
}
|
|
77346
77367
|
}
|
|
77347
77368
|
}
|
|
77369
|
+
function checkGrammarDecorator(decorator) {
|
|
77370
|
+
const sourceFile = getSourceFileOfNode(decorator);
|
|
77371
|
+
if (!hasParseDiagnostics(sourceFile)) {
|
|
77372
|
+
let node = decorator.expression;
|
|
77373
|
+
if (isParenthesizedExpression(node)) {
|
|
77374
|
+
return false;
|
|
77375
|
+
}
|
|
77376
|
+
let canHaveCallExpression = true;
|
|
77377
|
+
let errorNode;
|
|
77378
|
+
while (true) {
|
|
77379
|
+
if (isExpressionWithTypeArguments(node) || isNonNullExpression(node)) {
|
|
77380
|
+
node = node.expression;
|
|
77381
|
+
continue;
|
|
77382
|
+
}
|
|
77383
|
+
if (isCallExpression(node)) {
|
|
77384
|
+
if (!canHaveCallExpression) {
|
|
77385
|
+
errorNode = node;
|
|
77386
|
+
}
|
|
77387
|
+
if (node.questionDotToken) {
|
|
77388
|
+
errorNode = node.questionDotToken;
|
|
77389
|
+
}
|
|
77390
|
+
node = node.expression;
|
|
77391
|
+
canHaveCallExpression = false;
|
|
77392
|
+
continue;
|
|
77393
|
+
}
|
|
77394
|
+
if (isPropertyAccessExpression(node)) {
|
|
77395
|
+
if (node.questionDotToken) {
|
|
77396
|
+
errorNode = node.questionDotToken;
|
|
77397
|
+
}
|
|
77398
|
+
node = node.expression;
|
|
77399
|
+
canHaveCallExpression = false;
|
|
77400
|
+
continue;
|
|
77401
|
+
}
|
|
77402
|
+
if (!isIdentifier(node)) {
|
|
77403
|
+
errorNode = node;
|
|
77404
|
+
}
|
|
77405
|
+
break;
|
|
77406
|
+
}
|
|
77407
|
+
if (errorNode) {
|
|
77408
|
+
addRelatedInfo(
|
|
77409
|
+
error(decorator.expression, Diagnostics.Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator),
|
|
77410
|
+
createDiagnosticForNode(errorNode, Diagnostics.Invalid_syntax_in_decorator)
|
|
77411
|
+
);
|
|
77412
|
+
return true;
|
|
77413
|
+
}
|
|
77414
|
+
}
|
|
77415
|
+
return false;
|
|
77416
|
+
}
|
|
77348
77417
|
function checkDecorator(node) {
|
|
77418
|
+
checkGrammarDecorator(node);
|
|
77349
77419
|
const signature = getResolvedSignature(node);
|
|
77350
77420
|
checkDeprecatedSignature(signature, node);
|
|
77351
77421
|
const returnType = getReturnTypeOfSignature(signature);
|
|
@@ -89334,7 +89404,7 @@ function transformTypeScript(context) {
|
|
|
89334
89404
|
),
|
|
89335
89405
|
valueExpression
|
|
89336
89406
|
);
|
|
89337
|
-
const outerAssignment = valueExpression
|
|
89407
|
+
const outerAssignment = isSyntacticallyString(valueExpression) ? innerAssignment : factory2.createAssignment(
|
|
89338
89408
|
factory2.createElementAccessExpression(
|
|
89339
89409
|
currentNamespaceContainerName,
|
|
89340
89410
|
innerAssignment
|