I have string arrays that I construct with const assertions then use them to create union types.
const keys = ["foo", "bar", "moo"] as const;
type keysUnion = typeof keys[number]; // type keysUnion = "foo" | "bar" | "moo"
Is there a way to make a utility type that does the same thing with having to type typeof and [number] each time? Asking because I use this pattern multiple times so would be nice to make it more succinct.