0

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.

1 Answer 1

2

Try this:

var storage: { Id: string; Sequence: string[]; } = { Id: null, Sequence: [] };
Sign up to request clarification or add additional context in comments.

2 Comments

tried above but getting below error: Error 1 Cannot convert '{}' to '{ Id: string; Sequence: string[]; }': Type '{}' is missing property 'Id' from type '{ Id: string; Sequence: string[]; }'
Ooops. Sorry about that. I fixed my answer. I typed = instead of :

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.