andreypopp / validated

Validate your configurations with precise error messages
91 stars 14 forks source link

maybe(T) gets flow type T instead of ?T #6

Closed dbrockman closed 7 years ago

dbrockman commented 7 years ago

First of all, this is a really cool use of Flow!

The only problem I've had so far is that maybe() will have the flow type of the type it wraps, i.e. maybe(string) will have the flow type string and not ?string

I believe that this can be fixed by changing the definition of MaybeNode<V> so that it extends Node<?V> instead of Node<$NonMaybeType<V>>

+ export class MaybeNode<V> extends Node<?V> {
- export class MaybeNode<V> extends Node<$NonMaybeType<V>> {
andreypopp commented 7 years ago

Good catch! Will fix asap. Or if you want to do a PR ;) (tests could be also useful)

andreypopp commented 7 years ago

Fixed in 0.8.3