Closed
Description
Bug Report
π Search Terms
conditional type extends boolean
π Version & Regression Information
4.3.2
β― Playground Link
Playground link with relevant code
π» Code
type TestFunction<I, O> = I extends void ? () => O : (result: I) => O;
const numberFunction: TestFunction<number, void> = () => {};
numberFunction(1);
const booleanFunction1: TestFunction<boolean, void> = () => {};
booleanFunction1(true);
const booleanFunction2: TestFunction<Boolean, void> = () => {};
booleanFunction2(true);
π Actual behavior
Looks like the keyword extends
does not work with primitive type boolean
but with Class Boolean
and also with primitive type number
.
TS2345: Argument of type 'boolean' is not assignable to parameter of type 'never'.
π Expected behavior
booleanFunction2
should act like booleanFunction1
Metadata
Metadata
Assignees
Labels
No labels