@typescript-deploys/pr-build 5.5.0-pr-57465-98 → 5.5.0-pr-57465-103

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 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-insiders.20240313`;
21
+ var version = `${versionMajorMinor}.0-insiders.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() {
@@ -55643,7 +55661,7 @@ function createTypeChecker(host) {
55643
55661
  }
55644
55662
  if (type || jsdocPredicate) {
55645
55663
  signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
55646
- } else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType.flags & 16 /* Boolean */)) {
55664
+ } else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType.flags & 16 /* Boolean */) && getParameterCount(signature) > 0) {
55647
55665
  const { declaration } = signature;
55648
55666
  signature.resolvedTypePredicate = noTypePredicate;
55649
55667
  signature.resolvedTypePredicate = getTypePredicateFromBody(declaration) || noTypePredicate;
@@ -57599,7 +57617,7 @@ function createTypeChecker(host) {
57599
57617
  const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
57600
57618
  const typeVariable = typeSet[typeVarIndex];
57601
57619
  const primitiveType = typeSet[1 - typeVarIndex];
57602
- if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) || includes & 16777216 /* IncludesEmptyObject */)) {
57620
+ if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) && !isGenericStringLikeType(primitiveType) || includes & 16777216 /* IncludesEmptyObject */)) {
57603
57621
  const constraint = getBaseConstraintOfType(typeVariable);
57604
57622
  if (constraint && everyType(constraint, (t) => !!(t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) || isEmptyAnonymousObjectType(t))) {
57605
57623
  if (isTypeStrictSubtypeOf(constraint, primitiveType)) {
@@ -58204,6 +58222,9 @@ function createTypeChecker(host) {
58204
58222
  function isPatternLiteralType(type) {
58205
58223
  return !!(type.flags & 134217728 /* TemplateLiteral */) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456 /* StringMapping */) && isPatternLiteralPlaceholderType(type.type);
58206
58224
  }
58225
+ function isGenericStringLikeType(type) {
58226
+ return !!(type.flags & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) && !isPatternLiteralType(type);
58227
+ }
58207
58228
  function isGenericType(type) {
58208
58229
  return !!getGenericObjectFlags(type);
58209
58230
  }
@@ -58226,7 +58247,7 @@ function createTypeChecker(host) {
58226
58247
  }
58227
58248
  return type.objectFlags & 12582912 /* IsGenericType */;
58228
58249
  }
58229
- return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
58250
+ return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */) || isGenericStringLikeType(type) ? 8388608 /* IsGenericIndexType */ : 0);
58230
58251
  }
58231
58252
  function getSimplifiedType(type, writing) {
58232
58253
  return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
@@ -74081,7 +74102,7 @@ function createTypeChecker(host) {
74081
74102
  return void 0;
74082
74103
  }
74083
74104
  const functionFlags = getFunctionFlags(func);
74084
- if (functionFlags !== 0 /* Normal */ || func.parameters.length === 0)
74105
+ if (functionFlags !== 0 /* Normal */)
74085
74106
  return void 0;
74086
74107
  let singleReturn;
74087
74108
  if (func.body && func.body.kind !== 241 /* Block */) {
@@ -74108,7 +74129,7 @@ function createTypeChecker(host) {
74108
74129
  return void 0;
74109
74130
  return forEach(func.parameters, (param, i) => {
74110
74131
  const initType = getTypeOfSymbol(param.symbol);
74111
- if (!initType || initType.flags & 16 /* Boolean */ || !isIdentifier(param.name) || isSymbolAssigned(param.symbol)) {
74132
+ if (!initType || initType.flags & 16 /* Boolean */ || !isIdentifier(param.name) || isSymbolAssigned(param.symbol) || isRestParameter(param)) {
74112
74133
  return;
74113
74134
  }
74114
74135
  const trueType2 = checkIfExpressionRefinesParameter(func, expr, param, initType);
@@ -77414,7 +77435,56 @@ function createTypeChecker(host) {
77414
77435
  }
77415
77436
  }
77416
77437
  }
77438
+ function checkGrammarDecorator(decorator) {
77439
+ const sourceFile = getSourceFileOfNode(decorator);
77440
+ if (!hasParseDiagnostics(sourceFile)) {
77441
+ let node = decorator.expression;
77442
+ if (isParenthesizedExpression(node)) {
77443
+ return false;
77444
+ }
77445
+ let canHaveCallExpression = true;
77446
+ let errorNode;
77447
+ while (true) {
77448
+ if (isExpressionWithTypeArguments(node) || isNonNullExpression(node)) {
77449
+ node = node.expression;
77450
+ continue;
77451
+ }
77452
+ if (isCallExpression(node)) {
77453
+ if (!canHaveCallExpression) {
77454
+ errorNode = node;
77455
+ }
77456
+ if (node.questionDotToken) {
77457
+ errorNode = node.questionDotToken;
77458
+ }
77459
+ node = node.expression;
77460
+ canHaveCallExpression = false;
77461
+ continue;
77462
+ }
77463
+ if (isPropertyAccessExpression(node)) {
77464
+ if (node.questionDotToken) {
77465
+ errorNode = node.questionDotToken;
77466
+ }
77467
+ node = node.expression;
77468
+ canHaveCallExpression = false;
77469
+ continue;
77470
+ }
77471
+ if (!isIdentifier(node)) {
77472
+ errorNode = node;
77473
+ }
77474
+ break;
77475
+ }
77476
+ if (errorNode) {
77477
+ addRelatedInfo(
77478
+ error(decorator.expression, Diagnostics.Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator),
77479
+ createDiagnosticForNode(errorNode, Diagnostics.Invalid_syntax_in_decorator)
77480
+ );
77481
+ return true;
77482
+ }
77483
+ }
77484
+ return false;
77485
+ }
77417
77486
  function checkDecorator(node) {
77487
+ checkGrammarDecorator(node);
77418
77488
  const signature = getResolvedSignature(node);
77419
77489
  checkDeprecatedSignature(signature, node);
77420
77490
  const returnType = getReturnTypeOfSignature(signature);
@@ -89403,7 +89473,7 @@ function transformTypeScript(context) {
89403
89473
  ),
89404
89474
  valueExpression
89405
89475
  );
89406
- const outerAssignment = valueExpression.kind === 11 /* StringLiteral */ ? innerAssignment : factory2.createAssignment(
89476
+ const outerAssignment = isSyntacticallyString(valueExpression) ? innerAssignment : factory2.createAssignment(
89407
89477
  factory2.createElementAccessExpression(
89408
89478
  currentNamespaceContainerName,
89409
89479
  innerAssignment