This is going off-topic, apologies.
Yes, of course, re using TypeScript or Flow. However ... I'm not a fan of TypeScript -- if I'm going to use a different "language" (albeit one that's a transpile-able thin veneer over JS) I may as well switch to a language w/ an even better type system.
Flow, from the little I know, is closer to what I want -- still JS, but an annotation or "compilation switch" makes everything typecheck.