Interface as an Object Type with a TypeScript Array
You can also specify an interface as the type for the entire object.
Let's look at an example. First, let's make an interface for the product:
interface Product {
name: string,
colors: string[]
};
Then we create an object, specifying its type as the corresponding interface:
let prod: Product = {
name: 'notebook',
colors: ['red', 'black', 'gray']
}
Make a country object that contains the page title and an array of its cities.