Skip to content

Conversation

@LinusU
Copy link
Collaborator

@LinusU LinusU commented Aug 10, 2018

No description provided.

input.age === undefined
input.age === 1
if (typeof input.age !== 'undefined') assertType<number>(input.age)
if (typeof input.age !== 'number') assertType<undefined>(input.age)
Copy link
Collaborator Author

@LinusU LinusU Aug 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dance is used since it's valid to pass a number to a function accepting number | undefined.

@LinusU LinusU merged commit 7160756 into master Aug 10, 2018
@LinusU LinusU deleted the ts-required branch August 10, 2018 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants