@typescript-deploys/pr-build 5.0.0-pr-49627-28 → 5.0.0-pr-52807-23

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
@@ -47824,7 +47824,7 @@ function createTypeChecker(host) {
47824
47824
  );
47825
47825
  }
47826
47826
  function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
47827
- var _a2, _b, _c, _d, _e;
47827
+ var _a2, _b, _c, _d;
47828
47828
  const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
47829
47829
  if (suppressAny)
47830
47830
  context.flags &= ~256 /* SuppressAnyReturnType */;
@@ -47841,29 +47841,6 @@ function createTypeChecker(host) {
47841
47841
  /*skipUnionExpanding*/
47842
47842
  true
47843
47843
  )[0];
47844
- let restoreEnclosingDeclaration;
47845
- if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
47846
- const locals = (_a2 = context.fakeScopeLocals) != null ? _a2 : context.fakeScopeLocals = createSymbolTable();
47847
- let newLocals;
47848
- for (const param of expandedParams) {
47849
- if (!locals.has(param.escapedName)) {
47850
- newLocals = append(newLocals, param.escapedName);
47851
- locals.set(param.escapedName, param);
47852
- }
47853
- }
47854
- if (newLocals) {
47855
- const fakeScope = parseNodeFactory.createBlock(emptyArray);
47856
- getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
47857
- fakeScope.locals = locals;
47858
- const saveEnclosingDeclaration = context.enclosingDeclaration;
47859
- setParent(fakeScope, saveEnclosingDeclaration);
47860
- context.enclosingDeclaration = fakeScope;
47861
- restoreEnclosingDeclaration = () => {
47862
- context.enclosingDeclaration = saveEnclosingDeclaration;
47863
- forEach(newLocals, (s) => locals.delete(s));
47864
- };
47865
- }
47866
- }
47867
47844
  const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 173 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
47868
47845
  const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
47869
47846
  if (thisParameter) {
@@ -47889,11 +47866,11 @@ function createTypeChecker(host) {
47889
47866
  const flags = modifiersToFlags(modifiers);
47890
47867
  modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
47891
47868
  }
47892
- const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
47869
+ const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_a2 = options == null ? void 0 : options.name) != null ? _a2 : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
47893
47870
  modifiers,
47894
47871
  /*asteriskToken*/
47895
47872
  void 0,
47896
- (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
47873
+ (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""),
47897
47874
  /*questionToken*/
47898
47875
  void 0,
47899
47876
  typeParameters,
@@ -47908,14 +47885,14 @@ function createTypeChecker(host) {
47908
47885
  void 0
47909
47886
  ) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
47910
47887
  modifiers,
47911
- (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
47888
+ (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
47912
47889
  parameters,
47913
47890
  returnTypeNode,
47914
47891
  /*body*/
47915
47892
  void 0
47916
47893
  ) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
47917
47894
  modifiers,
47918
- (_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
47895
+ (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
47919
47896
  parameters,
47920
47897
  /*body*/
47921
47898
  void 0
@@ -47950,7 +47927,6 @@ function createTypeChecker(host) {
47950
47927
  if (typeArguments) {
47951
47928
  node.typeArguments = factory.createNodeArray(typeArguments);
47952
47929
  }
47953
- restoreEnclosingDeclaration == null ? void 0 : restoreEnclosingDeclaration();
47954
47930
  return node;
47955
47931
  }
47956
47932
  function tryGetThisParameterDeclaration(signature, context) {
@@ -48565,12 +48541,9 @@ function createTypeChecker(host) {
48565
48541
  function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
48566
48542
  return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
48567
48543
  }
48568
- function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
48569
- return findAncestor(enclosingDeclaration, (n) => !getNodeLinks(n).fakeScopeForSignatureDeclaration);
48570
- }
48571
48544
  function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
48572
48545
  if (!isErrorType(type) && enclosingDeclaration) {
48573
- const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
48546
+ const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
48574
48547
  if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
48575
48548
  const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
48576
48549
  if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
@@ -48602,8 +48575,7 @@ function createTypeChecker(host) {
48602
48575
  function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
48603
48576
  if (!isErrorType(type) && context.enclosingDeclaration) {
48604
48577
  const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
48605
- const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
48606
- if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
48578
+ if (!!findAncestor(annotation, (n) => n === context.enclosingDeclaration) && annotation) {
48607
48579
  const annotated = getTypeFromTypeNode(annotation);
48608
48580
  const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
48609
48581
  if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
@@ -61862,6 +61834,17 @@ function createTypeChecker(host) {
61862
61834
  function getBaseTypeOfLiteralTypeForComparison(type) {
61863
61835
  return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
61864
61836
  }
61837
+ function getValueOfResult(type) {
61838
+ const valueOf = getPropertyOfType(type, "valueOf");
61839
+ if (valueOf) {
61840
+ const signatures = getSignaturesOfType(getTypeOfSymbol(valueOf), 0 /* Call */);
61841
+ if (signatures && signatures.length > 0) {
61842
+ const returnType = getReturnTypeOfSignature(signatures[0]);
61843
+ return returnType;
61844
+ }
61845
+ }
61846
+ return type;
61847
+ }
61865
61848
  function getWidenedLiteralType(type) {
61866
61849
  return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
61867
61850
  }
@@ -72933,9 +72916,17 @@ function createTypeChecker(host) {
72933
72916
  if (isTypeAny(left2) || isTypeAny(right2)) {
72934
72917
  return true;
72935
72918
  }
72919
+ if (!(left2.flags & 134348796 /* Primitive */))
72920
+ left2 = getValueOfResult(left2);
72921
+ if (!(right2.flags & 134348796 /* Primitive */))
72922
+ right2 = getValueOfResult(right2);
72936
72923
  const leftAssignableToNumber = isTypeAssignableTo(left2, numberOrBigIntType);
72937
- const rightAssignableToNumber = isTypeAssignableTo(right2, numberOrBigIntType);
72938
- return leftAssignableToNumber && rightAssignableToNumber || !leftAssignableToNumber && !rightAssignableToNumber && areTypesComparable(left2, right2);
72924
+ if (leftAssignableToNumber) {
72925
+ const rightAssignableToNumber = isTypeAssignableTo(right2, numberOrBigIntType);
72926
+ if (rightAssignableToNumber)
72927
+ return true;
72928
+ }
72929
+ return isTypeAssignableTo(left2, stringType) && isTypeAssignableTo(right2, stringType);
72939
72930
  });
72940
72931
  }
72941
72932
  return booleanType;
package/lib/tsserver.js CHANGED
@@ -52400,7 +52400,7 @@ function createTypeChecker(host) {
52400
52400
  );
52401
52401
  }
52402
52402
  function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
52403
- var _a2, _b, _c, _d, _e;
52403
+ var _a2, _b, _c, _d;
52404
52404
  const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
52405
52405
  if (suppressAny)
52406
52406
  context.flags &= ~256 /* SuppressAnyReturnType */;
@@ -52417,29 +52417,6 @@ function createTypeChecker(host) {
52417
52417
  /*skipUnionExpanding*/
52418
52418
  true
52419
52419
  )[0];
52420
- let restoreEnclosingDeclaration;
52421
- if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
52422
- const locals = (_a2 = context.fakeScopeLocals) != null ? _a2 : context.fakeScopeLocals = createSymbolTable();
52423
- let newLocals;
52424
- for (const param of expandedParams) {
52425
- if (!locals.has(param.escapedName)) {
52426
- newLocals = append(newLocals, param.escapedName);
52427
- locals.set(param.escapedName, param);
52428
- }
52429
- }
52430
- if (newLocals) {
52431
- const fakeScope = parseNodeFactory.createBlock(emptyArray);
52432
- getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
52433
- fakeScope.locals = locals;
52434
- const saveEnclosingDeclaration = context.enclosingDeclaration;
52435
- setParent(fakeScope, saveEnclosingDeclaration);
52436
- context.enclosingDeclaration = fakeScope;
52437
- restoreEnclosingDeclaration = () => {
52438
- context.enclosingDeclaration = saveEnclosingDeclaration;
52439
- forEach(newLocals, (s) => locals.delete(s));
52440
- };
52441
- }
52442
- }
52443
52420
  const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 173 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
52444
52421
  const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
52445
52422
  if (thisParameter) {
@@ -52465,11 +52442,11 @@ function createTypeChecker(host) {
52465
52442
  const flags = modifiersToFlags(modifiers);
52466
52443
  modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
52467
52444
  }
52468
- const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
52445
+ const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_a2 = options == null ? void 0 : options.name) != null ? _a2 : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
52469
52446
  modifiers,
52470
52447
  /*asteriskToken*/
52471
52448
  void 0,
52472
- (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
52449
+ (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""),
52473
52450
  /*questionToken*/
52474
52451
  void 0,
52475
52452
  typeParameters,
@@ -52484,14 +52461,14 @@ function createTypeChecker(host) {
52484
52461
  void 0
52485
52462
  ) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
52486
52463
  modifiers,
52487
- (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
52464
+ (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
52488
52465
  parameters,
52489
52466
  returnTypeNode,
52490
52467
  /*body*/
52491
52468
  void 0
52492
52469
  ) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
52493
52470
  modifiers,
52494
- (_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
52471
+ (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
52495
52472
  parameters,
52496
52473
  /*body*/
52497
52474
  void 0
@@ -52526,7 +52503,6 @@ function createTypeChecker(host) {
52526
52503
  if (typeArguments) {
52527
52504
  node.typeArguments = factory.createNodeArray(typeArguments);
52528
52505
  }
52529
- restoreEnclosingDeclaration == null ? void 0 : restoreEnclosingDeclaration();
52530
52506
  return node;
52531
52507
  }
52532
52508
  function tryGetThisParameterDeclaration(signature, context) {
@@ -53141,12 +53117,9 @@ function createTypeChecker(host) {
53141
53117
  function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
53142
53118
  return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
53143
53119
  }
53144
- function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
53145
- return findAncestor(enclosingDeclaration, (n) => !getNodeLinks(n).fakeScopeForSignatureDeclaration);
53146
- }
53147
53120
  function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
53148
53121
  if (!isErrorType(type) && enclosingDeclaration) {
53149
- const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
53122
+ const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
53150
53123
  if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
53151
53124
  const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
53152
53125
  if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
@@ -53178,8 +53151,7 @@ function createTypeChecker(host) {
53178
53151
  function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
53179
53152
  if (!isErrorType(type) && context.enclosingDeclaration) {
53180
53153
  const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
53181
- const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
53182
- if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
53154
+ if (!!findAncestor(annotation, (n) => n === context.enclosingDeclaration) && annotation) {
53183
53155
  const annotated = getTypeFromTypeNode(annotation);
53184
53156
  const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
53185
53157
  if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
@@ -66438,6 +66410,17 @@ function createTypeChecker(host) {
66438
66410
  function getBaseTypeOfLiteralTypeForComparison(type) {
66439
66411
  return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
66440
66412
  }
66413
+ function getValueOfResult(type) {
66414
+ const valueOf = getPropertyOfType(type, "valueOf");
66415
+ if (valueOf) {
66416
+ const signatures = getSignaturesOfType(getTypeOfSymbol(valueOf), 0 /* Call */);
66417
+ if (signatures && signatures.length > 0) {
66418
+ const returnType = getReturnTypeOfSignature(signatures[0]);
66419
+ return returnType;
66420
+ }
66421
+ }
66422
+ return type;
66423
+ }
66441
66424
  function getWidenedLiteralType(type) {
66442
66425
  return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
66443
66426
  }
@@ -77509,9 +77492,17 @@ function createTypeChecker(host) {
77509
77492
  if (isTypeAny(left2) || isTypeAny(right2)) {
77510
77493
  return true;
77511
77494
  }
77495
+ if (!(left2.flags & 134348796 /* Primitive */))
77496
+ left2 = getValueOfResult(left2);
77497
+ if (!(right2.flags & 134348796 /* Primitive */))
77498
+ right2 = getValueOfResult(right2);
77512
77499
  const leftAssignableToNumber = isTypeAssignableTo(left2, numberOrBigIntType);
77513
- const rightAssignableToNumber = isTypeAssignableTo(right2, numberOrBigIntType);
77514
- return leftAssignableToNumber && rightAssignableToNumber || !leftAssignableToNumber && !rightAssignableToNumber && areTypesComparable(left2, right2);
77500
+ if (leftAssignableToNumber) {
77501
+ const rightAssignableToNumber = isTypeAssignableTo(right2, numberOrBigIntType);
77502
+ if (rightAssignableToNumber)
77503
+ return true;
77504
+ }
77505
+ return isTypeAssignableTo(left2, stringType) && isTypeAssignableTo(right2, stringType);
77515
77506
  });
77516
77507
  }
77517
77508
  return booleanType;
@@ -50209,7 +50209,7 @@ ${lanes.join("\n")}
50209
50209
  );
50210
50210
  }
50211
50211
  function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
50212
- var _a2, _b, _c, _d, _e;
50212
+ var _a2, _b, _c, _d;
50213
50213
  const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
50214
50214
  if (suppressAny)
50215
50215
  context.flags &= ~256 /* SuppressAnyReturnType */;
@@ -50226,29 +50226,6 @@ ${lanes.join("\n")}
50226
50226
  /*skipUnionExpanding*/
50227
50227
  true
50228
50228
  )[0];
50229
- let restoreEnclosingDeclaration;
50230
- if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
50231
- const locals = (_a2 = context.fakeScopeLocals) != null ? _a2 : context.fakeScopeLocals = createSymbolTable();
50232
- let newLocals;
50233
- for (const param of expandedParams) {
50234
- if (!locals.has(param.escapedName)) {
50235
- newLocals = append(newLocals, param.escapedName);
50236
- locals.set(param.escapedName, param);
50237
- }
50238
- }
50239
- if (newLocals) {
50240
- const fakeScope = parseNodeFactory.createBlock(emptyArray);
50241
- getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
50242
- fakeScope.locals = locals;
50243
- const saveEnclosingDeclaration = context.enclosingDeclaration;
50244
- setParent(fakeScope, saveEnclosingDeclaration);
50245
- context.enclosingDeclaration = fakeScope;
50246
- restoreEnclosingDeclaration = () => {
50247
- context.enclosingDeclaration = saveEnclosingDeclaration;
50248
- forEach(newLocals, (s) => locals.delete(s));
50249
- };
50250
- }
50251
- }
50252
50229
  const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 173 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
50253
50230
  const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
50254
50231
  if (thisParameter) {
@@ -50274,11 +50251,11 @@ ${lanes.join("\n")}
50274
50251
  const flags = modifiersToFlags(modifiers);
50275
50252
  modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
50276
50253
  }
50277
- const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
50254
+ const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_a2 = options == null ? void 0 : options.name) != null ? _a2 : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
50278
50255
  modifiers,
50279
50256
  /*asteriskToken*/
50280
50257
  void 0,
50281
- (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
50258
+ (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""),
50282
50259
  /*questionToken*/
50283
50260
  void 0,
50284
50261
  typeParameters,
@@ -50293,14 +50270,14 @@ ${lanes.join("\n")}
50293
50270
  void 0
50294
50271
  ) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
50295
50272
  modifiers,
50296
- (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
50273
+ (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
50297
50274
  parameters,
50298
50275
  returnTypeNode,
50299
50276
  /*body*/
50300
50277
  void 0
50301
50278
  ) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
50302
50279
  modifiers,
50303
- (_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
50280
+ (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
50304
50281
  parameters,
50305
50282
  /*body*/
50306
50283
  void 0
@@ -50335,7 +50312,6 @@ ${lanes.join("\n")}
50335
50312
  if (typeArguments) {
50336
50313
  node.typeArguments = factory.createNodeArray(typeArguments);
50337
50314
  }
50338
- restoreEnclosingDeclaration == null ? void 0 : restoreEnclosingDeclaration();
50339
50315
  return node;
50340
50316
  }
50341
50317
  function tryGetThisParameterDeclaration(signature, context) {
@@ -50950,12 +50926,9 @@ ${lanes.join("\n")}
50950
50926
  function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
50951
50927
  return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
50952
50928
  }
50953
- function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
50954
- return findAncestor(enclosingDeclaration, (n) => !getNodeLinks(n).fakeScopeForSignatureDeclaration);
50955
- }
50956
50929
  function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
50957
50930
  if (!isErrorType(type) && enclosingDeclaration) {
50958
- const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
50931
+ const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
50959
50932
  if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
50960
50933
  const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
50961
50934
  if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
@@ -50987,8 +50960,7 @@ ${lanes.join("\n")}
50987
50960
  function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
50988
50961
  if (!isErrorType(type) && context.enclosingDeclaration) {
50989
50962
  const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
50990
- const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
50991
- if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
50963
+ if (!!findAncestor(annotation, (n) => n === context.enclosingDeclaration) && annotation) {
50992
50964
  const annotated = getTypeFromTypeNode(annotation);
50993
50965
  const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
50994
50966
  if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
@@ -64247,6 +64219,17 @@ ${lanes.join("\n")}
64247
64219
  function getBaseTypeOfLiteralTypeForComparison(type) {
64248
64220
  return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
64249
64221
  }
64222
+ function getValueOfResult(type) {
64223
+ const valueOf = getPropertyOfType(type, "valueOf");
64224
+ if (valueOf) {
64225
+ const signatures = getSignaturesOfType(getTypeOfSymbol(valueOf), 0 /* Call */);
64226
+ if (signatures && signatures.length > 0) {
64227
+ const returnType = getReturnTypeOfSignature(signatures[0]);
64228
+ return returnType;
64229
+ }
64230
+ }
64231
+ return type;
64232
+ }
64250
64233
  function getWidenedLiteralType(type) {
64251
64234
  return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
64252
64235
  }
@@ -75318,9 +75301,17 @@ ${lanes.join("\n")}
75318
75301
  if (isTypeAny(left2) || isTypeAny(right2)) {
75319
75302
  return true;
75320
75303
  }
75304
+ if (!(left2.flags & 134348796 /* Primitive */))
75305
+ left2 = getValueOfResult(left2);
75306
+ if (!(right2.flags & 134348796 /* Primitive */))
75307
+ right2 = getValueOfResult(right2);
75321
75308
  const leftAssignableToNumber = isTypeAssignableTo(left2, numberOrBigIntType);
75322
- const rightAssignableToNumber = isTypeAssignableTo(right2, numberOrBigIntType);
75323
- return leftAssignableToNumber && rightAssignableToNumber || !leftAssignableToNumber && !rightAssignableToNumber && areTypesComparable(left2, right2);
75309
+ if (leftAssignableToNumber) {
75310
+ const rightAssignableToNumber = isTypeAssignableTo(right2, numberOrBigIntType);
75311
+ if (rightAssignableToNumber)
75312
+ return true;
75313
+ }
75314
+ return isTypeAssignableTo(left2, stringType) && isTypeAssignableTo(right2, stringType);
75324
75315
  });
75325
75316
  }
75326
75317
  return booleanType;
package/lib/typescript.js CHANGED
@@ -50209,7 +50209,7 @@ ${lanes.join("\n")}
50209
50209
  );
50210
50210
  }
50211
50211
  function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
50212
- var _a2, _b, _c, _d, _e;
50212
+ var _a2, _b, _c, _d;
50213
50213
  const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
50214
50214
  if (suppressAny)
50215
50215
  context.flags &= ~256 /* SuppressAnyReturnType */;
@@ -50226,29 +50226,6 @@ ${lanes.join("\n")}
50226
50226
  /*skipUnionExpanding*/
50227
50227
  true
50228
50228
  )[0];
50229
- let restoreEnclosingDeclaration;
50230
- if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
50231
- const locals = (_a2 = context.fakeScopeLocals) != null ? _a2 : context.fakeScopeLocals = createSymbolTable();
50232
- let newLocals;
50233
- for (const param of expandedParams) {
50234
- if (!locals.has(param.escapedName)) {
50235
- newLocals = append(newLocals, param.escapedName);
50236
- locals.set(param.escapedName, param);
50237
- }
50238
- }
50239
- if (newLocals) {
50240
- const fakeScope = parseNodeFactory.createBlock(emptyArray);
50241
- getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
50242
- fakeScope.locals = locals;
50243
- const saveEnclosingDeclaration = context.enclosingDeclaration;
50244
- setParent(fakeScope, saveEnclosingDeclaration);
50245
- context.enclosingDeclaration = fakeScope;
50246
- restoreEnclosingDeclaration = () => {
50247
- context.enclosingDeclaration = saveEnclosingDeclaration;
50248
- forEach(newLocals, (s) => locals.delete(s));
50249
- };
50250
- }
50251
- }
50252
50229
  const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 173 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
50253
50230
  const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
50254
50231
  if (thisParameter) {
@@ -50274,11 +50251,11 @@ ${lanes.join("\n")}
50274
50251
  const flags = modifiersToFlags(modifiers);
50275
50252
  modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
50276
50253
  }
50277
- const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
50254
+ const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_a2 = options == null ? void 0 : options.name) != null ? _a2 : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
50278
50255
  modifiers,
50279
50256
  /*asteriskToken*/
50280
50257
  void 0,
50281
- (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
50258
+ (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""),
50282
50259
  /*questionToken*/
50283
50260
  void 0,
50284
50261
  typeParameters,
@@ -50293,14 +50270,14 @@ ${lanes.join("\n")}
50293
50270
  void 0
50294
50271
  ) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
50295
50272
  modifiers,
50296
- (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
50273
+ (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
50297
50274
  parameters,
50298
50275
  returnTypeNode,
50299
50276
  /*body*/
50300
50277
  void 0
50301
50278
  ) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
50302
50279
  modifiers,
50303
- (_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
50280
+ (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
50304
50281
  parameters,
50305
50282
  /*body*/
50306
50283
  void 0
@@ -50335,7 +50312,6 @@ ${lanes.join("\n")}
50335
50312
  if (typeArguments) {
50336
50313
  node.typeArguments = factory.createNodeArray(typeArguments);
50337
50314
  }
50338
- restoreEnclosingDeclaration == null ? void 0 : restoreEnclosingDeclaration();
50339
50315
  return node;
50340
50316
  }
50341
50317
  function tryGetThisParameterDeclaration(signature, context) {
@@ -50950,12 +50926,9 @@ ${lanes.join("\n")}
50950
50926
  function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
50951
50927
  return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
50952
50928
  }
50953
- function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
50954
- return findAncestor(enclosingDeclaration, (n) => !getNodeLinks(n).fakeScopeForSignatureDeclaration);
50955
- }
50956
50929
  function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
50957
50930
  if (!isErrorType(type) && enclosingDeclaration) {
50958
- const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
50931
+ const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
50959
50932
  if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
50960
50933
  const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
50961
50934
  if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
@@ -50987,8 +50960,7 @@ ${lanes.join("\n")}
50987
50960
  function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
50988
50961
  if (!isErrorType(type) && context.enclosingDeclaration) {
50989
50962
  const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
50990
- const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
50991
- if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
50963
+ if (!!findAncestor(annotation, (n) => n === context.enclosingDeclaration) && annotation) {
50992
50964
  const annotated = getTypeFromTypeNode(annotation);
50993
50965
  const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
50994
50966
  if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
@@ -64247,6 +64219,17 @@ ${lanes.join("\n")}
64247
64219
  function getBaseTypeOfLiteralTypeForComparison(type) {
64248
64220
  return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
64249
64221
  }
64222
+ function getValueOfResult(type) {
64223
+ const valueOf = getPropertyOfType(type, "valueOf");
64224
+ if (valueOf) {
64225
+ const signatures = getSignaturesOfType(getTypeOfSymbol(valueOf), 0 /* Call */);
64226
+ if (signatures && signatures.length > 0) {
64227
+ const returnType = getReturnTypeOfSignature(signatures[0]);
64228
+ return returnType;
64229
+ }
64230
+ }
64231
+ return type;
64232
+ }
64250
64233
  function getWidenedLiteralType(type) {
64251
64234
  return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
64252
64235
  }
@@ -75318,9 +75301,17 @@ ${lanes.join("\n")}
75318
75301
  if (isTypeAny(left2) || isTypeAny(right2)) {
75319
75302
  return true;
75320
75303
  }
75304
+ if (!(left2.flags & 134348796 /* Primitive */))
75305
+ left2 = getValueOfResult(left2);
75306
+ if (!(right2.flags & 134348796 /* Primitive */))
75307
+ right2 = getValueOfResult(right2);
75321
75308
  const leftAssignableToNumber = isTypeAssignableTo(left2, numberOrBigIntType);
75322
- const rightAssignableToNumber = isTypeAssignableTo(right2, numberOrBigIntType);
75323
- return leftAssignableToNumber && rightAssignableToNumber || !leftAssignableToNumber && !rightAssignableToNumber && areTypesComparable(left2, right2);
75309
+ if (leftAssignableToNumber) {
75310
+ const rightAssignableToNumber = isTypeAssignableTo(right2, numberOrBigIntType);
75311
+ if (rightAssignableToNumber)
75312
+ return true;
75313
+ }
75314
+ return isTypeAssignableTo(left2, stringType) && isTypeAssignableTo(right2, stringType);
75324
75315
  });
75325
75316
  }
75326
75317
  return booleanType;
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.0.0-pr-49627-28",
5
+ "version": "5.0.0-pr-52807-23",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [