Hi,
Would like to share this result related to $Call. Not sure if this is a bug or expected behavior:
/* @flow */
type Fn = boolean => number
type ReturnType = $Call<<T, R>(T => R) => R, Fn>
type ArgumentType = $Call<<T, R>(T => R) => T, Fn>
// (true: ReturnType); // fails - correct
(1: ArgumentType); // does not fail - wrong?
type ArgumentType2 = $Call<<T, R>(T => R) => T & $NonMaybeType<T>, Fn>
// (1: ArgumentType2); // fails - correct
Seems ArgumentType has empty type, but ArgumentType2 has the correct boolean one.
The key point is T & $NonMaybeType<T> in the type ArgumentType2. I don't understand why this last bit fixes the type issue, would really appreciate some further explanation if someone knows more about this topic.
Thanks a lot for the library.
This appears to be a duplicate of #6647 and #6696.
Closing as duplicate of #6647
Most helpful comment
This appears to be a duplicate of #6647 and #6696.