At this point, TypeScript should just let us define types using plain imperative TS code that will execute during static analysis. Might as well.
type MyType<T> = someFunc(T)
Of course these functions might be typed too…
type MyType<T> = someFunc(T)
Of course these functions might be typed too…
What I'm saying is that if instead we said that all type annotations must follow existing JS grammar rules, with perhaps a couple of small additions, then we'd be able to support all sorts of complex type annotations in JS directly, using existing syntax. This would mean that TS's grammar would end up changing a bit, but that's a small price to pay for ongoing interoperability.
For example, instead of
type UserProperties = keyof typeof User;
which is tied to TS's arbitrary syntax, and not supported in Flow, use type UserProperties = keyOf(typeOf(User));