Categories
TypeScript Answers

How to define an array of strings in a TypeScript interface?

Spread the love

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.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.