Created
July 9, 2016 04:50
-
-
Save nmn/f125bf5575e0acabc79c48107d91aefb to your computer and use it in GitHub Desktop.
MagicFlowType 3: Type to convert nullable to non-nullable types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
type _NonNull<T, N: ?T> = T | |
type $NonNull<N> = _NonNull<*, N> | |
type Num = $NonNull<?number> | |
;(45: Num) | |
// $ExpectError | |
;(undefined: Num) | |
// $ExpectError | |
;(null: Num) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment