I\'ve looked around at various github threads and it seems as if SVG support is not merged / shipped in current versions of Flow.js (I\'m using VS Code extension vscode-fl
Interrim solution until the official inclusions are made...
For types that are missing, implement your own for that subset of properties that you intend to use.
For example, I am manipulating SVGs, so in a file SVGElement.js.flow
(named after the DOM type):
type SVGElement = HTMLElement &
{
fonts: [],
fillOpacity: number
//...
//In reality, SVGElement has many more properties, but you can include
//only those you will use and which thus require type-safety.
//You can add whatever you need, incrementally, as time passes.
}
Typing only subsets of methods & properties is easier than having to implement the entire type.
The &
allows inheritance from HTMLElement
present in /flow/lib/dom.js
; see intersection types.