You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I create an invalid instance of Foo with some kind of primitive type I'll get an error:
// In any of these flowtype checking works and fails because
// it knows those things are not Bar.
new Foo('bar', 'someName');
new Foo(1, 'someName');
new Foo({}, 'someName');
But then if I do something silly like this:
new Foo(new Function(), 'someName');
flowtype is perfectly happy with this and that sort of defeats the purpose of even having defined an interface in the first place. If I can just pass in any kind of instance object and flowtype doesn't see that what's passed in does not match the interface it should throw an error just like it did for {}.
The text was updated successfully, but these errors were encountered:
The current compile time checking when using interfaces for arguments to constructors seems to be too lenient.
For example given the following class:
And the following interface defined in another place:
If I create an invalid instance of Foo with some kind of primitive type I'll get an error:
But then if I do something silly like this:
new Foo(new Function(), 'someName');
flowtype is perfectly happy with this and that sort of defeats the purpose of even having defined an interface in the first place. If I can just pass in any kind of instance object and flowtype doesn't see that what's passed in does not match the interface it should throw an error just like it did for {}.
The text was updated successfully, but these errors were encountered: