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

Make "required" optional in TypeScript typings #167

Merged
merged 2 commits into from Aug 10, 2018
Merged

Make "required" optional in TypeScript typings #167

merged 2 commits into from Aug 10, 2018

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.

None yet

1 participant