Typescript intersection types with array of objects and an interface

Viewed 3837

I'm having a lot of trouble understanding the intersection types. Here it is what I'm referring to:

type FooList = Foo[] & {
    bar: string
};

interface Foo {
    baz: string;
}

After a lot of fiddling I'm unable to create a typed array of FooList.

These typings are not mine, they are from this library.

Does these types mean FooList must be an array of Foos and also have an object bar? Does each Foo object has to contain a property bar?

Here is the link to the playground

3 Answers
Related