-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Closed
Copy link
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed
Description
TypeScript Version: 2.0.0
Code
// strictNullChecks is on
var x: number[] = [];
var y: number = x[0];
y.toString(); // Cannot read property 'toString' of undefinedExpected behavior:
error TS2322: Type 'undefined' is not assignable to type 'number'
Actual behavior:
after compile with command tsc --strictNullChecks
Runtime exception: Cannot read property 'toString' of undefined
I thought strictNullChecks a there to prevent developer from seeing such kind of exceptions in run time.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed