-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed
Description
TS 2.4.1 with noImplicitReturns
enabled
class A {}
class B {}
// error: Not all code paths return a value.
const fn = (x: A | B) => {
if (x instanceof A) {
x // A
return 1
} else if (x instanceof B) {
x // B
return 2
} else {
x // never
}
}
I would not expect this to error because the if statement is exhaustive, therefore all code paths do return a value.
Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed