Skip to content

Commit 6a4f838

Browse files
committed
Accept baseline, fix lint
1 parent 161d1f1 commit 6a4f838

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/compiler/checker.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -36541,7 +36541,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3654136541
const hasInstanceMethodType = getSymbolHasInstanceMethodOfObjectType(rightType);
3654236542
if (hasInstanceMethodType) {
3654336543
// avoid a complex check for every `instanceof` when the `[Symbol.hasInstance]` method has a single
36544-
// call signature that neither restricts nor narrows (via type predicate) the LHS value, e.g.
36544+
// call signature that neither restricts nor narrows (via type predicate) the LHS value, e.g.
3654536545
// `(value: unknown) => boolean`.
3654636546
const cache = hasInstanceMethodType as HasInstanceMethodType;
3654736547
if (cache.hasSimpleUnrestrictedSingleCallSignature === undefined) {
@@ -36558,7 +36558,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3655836558
// parameter.
3655936559
const syntheticCall = createSyntheticHasInstanceMethodCall(left, right, leftType, hasInstanceMethodType);
3656036560
const returnType = getReturnTypeOfSignature(getResolvedSignature(syntheticCall));
36561-
36561+
3656236562
// We also verify that the return type of the `[Symbol.hasInstance]` method is assignable to
3656336563
// `boolean`. According to the spec, the runtime will actually perform `ToBoolean` on the result,
3656436564
// but this is more type-safe.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
symbolType1.ts(1,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.
2-
symbolType1.ts(2,19): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.
3-
symbolType1.ts(4,19): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.
2+
symbolType1.ts(2,19): error TS2857: The right-hand side of an 'instanceof' expression must be either of type 'any', an object type with a '[Symbol.hasInstance]()' method, or a type assignable to the 'Function' interface type.
3+
symbolType1.ts(4,19): error TS2857: The right-hand side of an 'instanceof' expression must be either of type 'any', an object type with a '[Symbol.hasInstance]()' method, or a type assignable to the 'Function' interface type.
44

55

66
==== symbolType1.ts (3 errors) ====
@@ -9,8 +9,8 @@ symbolType1.ts(4,19): error TS2359: The right-hand side of an 'instanceof' expre
99
!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.
1010
Symbol instanceof Symbol();
1111
~~~~~~~~
12-
!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.
12+
!!! error TS2857: The right-hand side of an 'instanceof' expression must be either of type 'any', an object type with a '[Symbol.hasInstance]()' method, or a type assignable to the 'Function' interface type.
1313
(Symbol() || {}) instanceof Object; // This one should be okay, it's a valid way of distinguishing types
1414
Symbol instanceof (Symbol() || {});
1515
~~~~~~~~~~~~~~~~
16-
!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.
16+
!!! error TS2857: The right-hand side of an 'instanceof' expression must be either of type 'any', an object type with a '[Symbol.hasInstance]()' method, or a type assignable to the 'Function' interface type.

0 commit comments

Comments
 (0)