The project I'm working on uses some 3rd-party libraries in which a main module defines classes that are imported and extended by other, associated modules. In my case the main module is three.js, a JavaScript 3D computer graphics library, and the other modules are extensions that extend the features of the main module. These superclasses are an important part of the interface to the extensions, and I would like to include their contribution. Flow has been a great tool for typechecking the rest of the project, but I haven't been able to describe this particular situation well.
I've played with the existing three.js libdef and looked through several others for ideas, without luck. You can certainly declare/export a class in one module and import its type into another, but while that can be used to describe function parameters and such, you can't define a class that extends the imported type: flow complains that it "Cannot reference type ...
[1] from a value position. [type-as-value]". I tried using the Class utility type, but that doesn't seem to be available in a libdef: using it causes a "Cannot resolve name Class
. [cannot-resolve-name]" error. Am I missing something obvious here? Perhaps there's an well-known workaround?
Thanks in advance for any suggestions.