flow
flow copied to clipboard
[WIP] Builtin declaration merging
Somewhat (~~sometimes~~) working fix for https://github.com/facebook/flow/issues/396
Nice!
Not really, I'm not sure this is right way to do this, but it works at least
@goodmind any plans to eventually add declaration merging for declare module eventually?
@kevinbarabash I'm not even sure if I'm implementing it right way, still wait on review from Flow team
@kevinbarabash just implemented declare module it was pretty easy actually, but it supports only ES declare export from modules, not private interfaces
Also you can't do augmentation in the same file, Flow would complain about re-declaring identifier
The thing you lose with this implementation is ability to completely override class with your own types, it would always merge them into original one
Also you can't really do anything with merging .js.flow files because they are orthogonal to declare module
I noticed you added GlobalThisT in this PR. It seems independent of the declaration merging. globalThis seems really hard to type properly given that it can have different properties depending on execution context.
Ah, because I was working on top of my globalThis PR,
I noticed that I can do globalThis.HTMLElement = 1; and it would make union of class HTMLElement | number