Object.keys(undefined) does not fail with strictNullChecks #17273
Labels
Bug
A bug in TypeScript
Domain: lib.d.ts
The issue relates to the different libraries shipped with TypeScript
Fixed
A PR has been merged for this issue
TypeScript Version: 2.4.1
Code:
Object.keys(undefined)
(
Object.getOwnPropertyNames
and similar have the same issue.)Expected behavior:
With strictNullChecks enabled it should result in an error (same as running the code as JavaScript).
Actual behavior:
It compiles without errors.
Possible solution:
In lib.*.d.ts replace
keys(o: any): string[];
bykeys(o: {}): string[];
The text was updated successfully, but these errors were encountered: