I have a type FooBar, that contains objects with different props. I want to get the keys from all objects. I thought that could be obtained by using keyof FooBar[number]; but it only returns the common keys.
type FooBar = [
{
foo: "hello";
bar: "goodbye";
},
{
foo: "hi";
bar: "goodbye";
fizz: "buzz";
}
];
type FooBarKeys = keyof FooBar[number];
// type FooBarKeys = "foo" | "bar"
How do I get all keys for all the objects?