But yes: I think TS is missing a way to derive runtime functionality from the type definitions - at least in the cases, where the types describe plain JSON.
Something along the lines of clojures' `spec`.
type Spec<T> = T extends (x: unknown) => x is infer U ? U : never; type Foo = Spec<typeof someTypeGuard>;
But yes: I think TS is missing a way to derive runtime functionality from the type definitions - at least in the cases, where the types describe plain JSON.
Something along the lines of clojures' `spec`.