typescript 5.5.0-dev.20240313 → 5.5.0-dev.20240315
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 +82 -5
- package/lib/tsserver.js +186 -86
- package/lib/typescript.js +186 -86
- 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.20240315`;
|
|
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)) {
|
|
@@ -57829,6 +57847,7 @@ function createTypeChecker(host) {
|
|
|
57829
57847
|
return links.resolvedType;
|
|
57830
57848
|
}
|
|
57831
57849
|
function getTemplateLiteralType(texts, types) {
|
|
57850
|
+
var _a, _b;
|
|
57832
57851
|
const unionIndex = findIndex(types, (t) => !!(t.flags & (131072 /* Never */ | 1048576 /* Union */)));
|
|
57833
57852
|
if (unionIndex >= 0) {
|
|
57834
57853
|
return checkCrossProductUnion(types) ? mapType(types[unionIndex], (t) => getTemplateLiteralType(texts, replaceElement(types, unionIndex, t))) : errorType;
|
|
@@ -57836,6 +57855,9 @@ function createTypeChecker(host) {
|
|
|
57836
57855
|
if (contains(types, wildcardType)) {
|
|
57837
57856
|
return wildcardType;
|
|
57838
57857
|
}
|
|
57858
|
+
if (texts.length === 2 && texts[0] === "" && texts[1] === "" && !(types[0].flags & 2944 /* Literal */) && !((_b = (_a = types[0].symbol) == null ? void 0 : _a.declarations) == null ? void 0 : _b.some((d) => d.parent.kind === 195 /* InferType */)) && isTypeAssignableTo(types[0], stringType)) {
|
|
57859
|
+
return types[0];
|
|
57860
|
+
}
|
|
57839
57861
|
const newTypes = [];
|
|
57840
57862
|
const newTexts = [];
|
|
57841
57863
|
let text = texts[0];
|
|
@@ -58196,6 +58218,9 @@ function createTypeChecker(host) {
|
|
|
58196
58218
|
function isPatternLiteralType(type) {
|
|
58197
58219
|
return !!(type.flags & 134217728 /* TemplateLiteral */) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456 /* StringMapping */) && isPatternLiteralPlaceholderType(type.type);
|
|
58198
58220
|
}
|
|
58221
|
+
function isGenericStringLikeType(type) {
|
|
58222
|
+
return !!(type.flags & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) && !isPatternLiteralType(type);
|
|
58223
|
+
}
|
|
58199
58224
|
function isGenericType(type) {
|
|
58200
58225
|
return !!getGenericObjectFlags(type);
|
|
58201
58226
|
}
|
|
@@ -58218,7 +58243,7 @@ function createTypeChecker(host) {
|
|
|
58218
58243
|
}
|
|
58219
58244
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
58220
58245
|
}
|
|
58221
|
-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */
|
|
58246
|
+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */) || isGenericStringLikeType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
58222
58247
|
}
|
|
58223
58248
|
function getSimplifiedType(type, writing) {
|
|
58224
58249
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -71485,7 +71510,10 @@ function createTypeChecker(host) {
|
|
|
71485
71510
|
return Debug.fail();
|
|
71486
71511
|
}
|
|
71487
71512
|
function getDecoratorArgumentCount(node, signature) {
|
|
71488
|
-
return compilerOptions.experimentalDecorators ? getLegacyDecoratorArgumentCount(node, signature) :
|
|
71513
|
+
return compilerOptions.experimentalDecorators ? getLegacyDecoratorArgumentCount(node, signature) : (
|
|
71514
|
+
// Allow the runtime to oversupply arguments to an ES decorator as long as there's at least one parameter.
|
|
71515
|
+
Math.min(Math.max(getParameterCount(signature), 1), 2)
|
|
71516
|
+
);
|
|
71489
71517
|
}
|
|
71490
71518
|
function getLegacyDecoratorArgumentCount(node, signature) {
|
|
71491
71519
|
switch (node.parent.kind) {
|
|
@@ -77345,7 +77373,56 @@ function createTypeChecker(host) {
|
|
|
77345
77373
|
}
|
|
77346
77374
|
}
|
|
77347
77375
|
}
|
|
77376
|
+
function checkGrammarDecorator(decorator) {
|
|
77377
|
+
const sourceFile = getSourceFileOfNode(decorator);
|
|
77378
|
+
if (!hasParseDiagnostics(sourceFile)) {
|
|
77379
|
+
let node = decorator.expression;
|
|
77380
|
+
if (isParenthesizedExpression(node)) {
|
|
77381
|
+
return false;
|
|
77382
|
+
}
|
|
77383
|
+
let canHaveCallExpression = true;
|
|
77384
|
+
let errorNode;
|
|
77385
|
+
while (true) {
|
|
77386
|
+
if (isExpressionWithTypeArguments(node) || isNonNullExpression(node)) {
|
|
77387
|
+
node = node.expression;
|
|
77388
|
+
continue;
|
|
77389
|
+
}
|
|
77390
|
+
if (isCallExpression(node)) {
|
|
77391
|
+
if (!canHaveCallExpression) {
|
|
77392
|
+
errorNode = node;
|
|
77393
|
+
}
|
|
77394
|
+
if (node.questionDotToken) {
|
|
77395
|
+
errorNode = node.questionDotToken;
|
|
77396
|
+
}
|
|
77397
|
+
node = node.expression;
|
|
77398
|
+
canHaveCallExpression = false;
|
|
77399
|
+
continue;
|
|
77400
|
+
}
|
|
77401
|
+
if (isPropertyAccessExpression(node)) {
|
|
77402
|
+
if (node.questionDotToken) {
|
|
77403
|
+
errorNode = node.questionDotToken;
|
|
77404
|
+
}
|
|
77405
|
+
node = node.expression;
|
|
77406
|
+
canHaveCallExpression = false;
|
|
77407
|
+
continue;
|
|
77408
|
+
}
|
|
77409
|
+
if (!isIdentifier(node)) {
|
|
77410
|
+
errorNode = node;
|
|
77411
|
+
}
|
|
77412
|
+
break;
|
|
77413
|
+
}
|
|
77414
|
+
if (errorNode) {
|
|
77415
|
+
addRelatedInfo(
|
|
77416
|
+
error(decorator.expression, Diagnostics.Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator),
|
|
77417
|
+
createDiagnosticForNode(errorNode, Diagnostics.Invalid_syntax_in_decorator)
|
|
77418
|
+
);
|
|
77419
|
+
return true;
|
|
77420
|
+
}
|
|
77421
|
+
}
|
|
77422
|
+
return false;
|
|
77423
|
+
}
|
|
77348
77424
|
function checkDecorator(node) {
|
|
77425
|
+
checkGrammarDecorator(node);
|
|
77349
77426
|
const signature = getResolvedSignature(node);
|
|
77350
77427
|
checkDeprecatedSignature(signature, node);
|
|
77351
77428
|
const returnType = getReturnTypeOfSignature(signature);
|
|
@@ -89334,7 +89411,7 @@ function transformTypeScript(context) {
|
|
|
89334
89411
|
),
|
|
89335
89412
|
valueExpression
|
|
89336
89413
|
);
|
|
89337
|
-
const outerAssignment = valueExpression
|
|
89414
|
+
const outerAssignment = isSyntacticallyString(valueExpression) ? innerAssignment : factory2.createAssignment(
|
|
89338
89415
|
factory2.createElementAccessExpression(
|
|
89339
89416
|
currentNamespaceContainerName,
|
|
89340
89417
|
innerAssignment
|