Should we be able to create $Intersection of generic object types?
type Functor<T> = {
map: <R>(fn: (value: T) => R) => Functor<R>
}
type Apply<T> = {
apply: <R>(apply: Apply<(value: T) => R>) => Apply<R>
}
// Types that implements Applicative must implement Apply
// Here Hegel show an error: All parameters should be an object type. Only first parameter should mutable object type. 0 is not.
type Applicative<T> = $Intersection<Apply<T>, { of: (value: T) => Applicative<T> }>
// Here Hegel show an error: All parameters should be an object type. Only first parameter should mutable object type. 0 is not.
type Monad<T> = $Intersection<Applicative<T>, Functor<T>>
Should we be able to create
$Intersection
of generic object types?