Skip to content

Primitive type guards are order independent - #9036

Merged
Nathan Shively-Sanders (sandersn) merged 4 commits into
masterfrom
primitive-type-guards-are-order-independent
Jun 13, 2016
Merged

Primitive type guards are order independent#9036
Nathan Shively-Sanders (sandersn) merged 4 commits into
masterfrom
primitive-type-guards-are-order-independent

Conversation

@sandersn

Copy link
Copy Markdown
Member

Fixes#9020

Previously, only type guards of the form `typeof x === 'string'` were
allowed. Now you can write `'string' === typeof x`.
@ahejlsberg

Copy link
Copy Markdown
Member

Shouldn't this also include checks of the form null === x?

@sandersn

Copy link
Copy Markdown
MemberAuthor

Good idea. Done.

@mhegazy

Copy link
Copy Markdown
Contributor

👍

@sandersn
Nathan Shively-Sanders (sandersn) deleted the primitive-type-guards-are-order-independent branch June 13, 2016 17:52
@microsoftMicrosoft (microsoft) locked and limited conversation to collaborators Jun 19, 2018
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@sandersn@ahejlsberg@mhegazy@msftclas