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
How to reuse types in project itself alike in imported projects?
In flow examples i found only ugly hack: all reusable types are prefixed and placed in one big file with exported declarations, like buffer$NonBufferEncoding.
But i want to write types once for internal and external purposes and place them in multiple files.
The text was updated successfully, but these errors were encountered:
This is something we're working on (see flow-typed/flow-typed#16), but for now the recommended way is to create a top-level declaration with a prefix containing the module name and $. For example, for a module foo, something like this:
class foo$Foo {
// ...
}
declare module foo {
declare var Foo = typeof foo$Foo;
}
Then you can depend on the top-level declaration from another module declaration, bar:
declare module bar {
declare class Bar extends foo$Foo {
// ...
}
}
I try to reuse exported interfaces between declaration files, but got an error:
Problem with filenames sorting, if i rename flow-test-a.js to flow-test-c.js, all works fine. Probably bug?
I created repository with this files: https://github.com/zerkalica/flowtest-bug
How to reuse types in project itself alike in imported projects?
In flow examples i found only ugly hack: all reusable types are prefixed and placed in one big file with exported declarations, like buffer$NonBufferEncoding.
But i want to write types once for internal and external purposes and place them in multiple files.
The text was updated successfully, but these errors were encountered: