Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object.keys(undefined) does not fail with strictNullChecks #17273

Closed
stephtr opened this issue Jul 18, 2017 · 0 comments
Closed

Object.keys(undefined) does not fail with strictNullChecks #17273

stephtr opened this issue Jul 18, 2017 · 0 comments
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

Comments

@stephtr
Copy link

stephtr commented Jul 18, 2017

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[]; by keys(o: {}): string[];

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript labels Jul 18, 2017
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Nov 9, 2017
@mhegazy mhegazy closed this as completed Nov 9, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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
Projects
None yet
Development

No branches or pull requests

3 participants