user2108168
user2108168

Reputation: 17

How to initialised complex array in typescript

I am trying to use variable which is as below:

var Storage: { Id: string; Sequence: string[]; } =???

without initializing if I am trying to use it is throwing undefined/null exception. How to initialized the above? I tried something like:

var Storage: { Id: string; Sequence: string[]; } = {null;[]};

But no luck.

Thanks.

Upvotes: 0

Views: 421

Answers (1)

Laith
Laith

Reputation: 6091

Try this:

var storage: { Id: string; Sequence: string[]; } = { Id: null, Sequence: [] };

Upvotes: 2

Related Questions