Sometimes, we want to define an array of strings in a TypeScript interface.
In this article, we’ll look at how to define an array of strings in a TypeScript interface.
How to define an array of strings in a TypeScript interface?
To define an array of strings in a TypeScript interface, we can set a property to a string variable.
For instance, we write
interface Addressable {
address: string[];
}
to define the Addressable
interface with the address
property set to a string array with string[]
.
Conclusion
To define an array of strings in a TypeScript interface, we can set a property to a string variable.