Skip to content

Instantly share code, notes, and snippets.

@nmn nmn/$NonNull.ts
Created Jul 9, 2016

Embed
What would you like to do?
MagicFlowType 3: Type to convert nullable to non-nullable types
/* @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
You can’t perform that action at this time.