Categories
JavaScript Answers

How to create an empty typed container array with TypeScript?

Spread the love

To create an empty typed container array with TypeScript, we can declare the type explicitly.

For instance, we write

const arr: Criminal[] = [];

to declare the arr array with the Criminal type.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *