-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already createdFixedA PR has been merged for this issueA PR has been merged for this issue
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
.
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already createdFixedA PR has been merged for this issueA PR has been merged for this issue