Flow: Flow fails checking against imported interface, but not when declared locally

Created on 15 Mar 2017  Â·  1Comment  Â·  Source: facebook/flow

I have a generic interface Provider referenced as a constructor parameter for a generic class ProviderCollection. When Provider is declared in the same file as ProviderCollection, flow correctly checks a union type of subtypes of Configuration as the input to a method on ProviderCollection. When I import the Provider type from another module, flow throws errors about members of the union of Configuration types.

Gist: https://gist.github.com/billschaller/2942ba31edb134cc94715f137ce6ac20

CC: @gabelevi

Most helpful comment

I've repro'd this – an imported interface does not function. I see:

  • incorrectly setting a variable typed to the interface does not produce an error
  • incorrectly setting a property of the interface-typed object does not produce an error

This means flow is failing to do basic type-checking in our current projects – please prioritize!

>All comments

I've repro'd this – an imported interface does not function. I see:

  • incorrectly setting a variable typed to the interface does not produce an error
  • incorrectly setting a property of the interface-typed object does not produce an error

This means flow is failing to do basic type-checking in our current projects – please prioritize!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

funtaps picture funtaps  Â·  3Comments

cubika picture cubika  Â·  3Comments

ghost picture ghost  Â·  3Comments

mmollaverdi picture mmollaverdi  Â·  3Comments

pelotom picture pelotom  Â·  3Comments