Closed
Description
TypeScript Version: 2.5.0
Code
const a: (d: string) => number = (d) => d.length;
const b: (d?: string) => number = a;
b();
Expected behavior:
When compiled with --strict
, the assignment of b
should cause a type error along the lines of:
string | undefined
is not assignable to typestring
.
Actual behavior:
The code compiles with --strict
, then throws an exception at runtime on the expression d.length
.