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
I tried to fix this, but it is a too complex task. I see that "babylon" parses generic type definitions correctly. I think we need to add generic type declarations to the context so that we can filter this names in "lib/findUndefinedIdentifiers.js". But we must treat js names and flow names in the context differently. If T is used as a js name then we need to import it. If T is used as a flow type then it is already defined.
Thanks for the report and the reproduction steps in the form of unit tests! Let's see if someone else is willing to take this on. I don't have much investment in flowscript unfortunately, the only project using it is (ironically) import-js.
It seems that import-js does not recognize flow's generic types:
It cause import-js to insert:
Though
T
is not a function, and it is already defined in this code snippet. Here is the generic's doc: https://flow.org/en/docs/types/generics/I tried to fix this, but it is a too complex task. I see that "babylon" parses generic type definitions correctly. I think we need to add generic type declarations to the context so that we can filter this names in "lib/findUndefinedIdentifiers.js". But we must treat js names and flow names in the context differently. If
T
is used as a js name then we need to import it. IfT
is used as a flow type then it is already defined.This are the tests I wrote for this task:
The text was updated successfully, but these errors were encountered: