I have a XInterface
defined as:
export interface XInterface {
foo: (() => Foo[]) | Foo[],
bar: string,
baz: number
}
When declaring an object using this interface, I want the type of foo
to be Foo[]
, like so:
const myObj: XInterface = {
[myFoo1, myFoo2],
'bar',
1
}
The challenge arises when ensuring that foo
is an array and not a function that returns an array. Any tips on how I can accomplish this?