Open azizhk opened 5 years ago
@azizhk here's another way to infer the type of an array!
export default function combos<T extends Input>(inp: T): {
[P in keyof T]: T[P] extends (infer ElementType)[] ? ElementType : any;
}[];
Found this repo after implementing my own solution in ts here https://github.com/tvler/prop-sets
Just thought I'd share types that I wrote for this package, in case someone is looking for it.
Not creating a PR because I could not use UNDEF to show that a particular key could be undefined in the output. Will create a PR when I have a better solution. Just leaving this here if someone needs it for types without using UNDEF.