简体   繁体   中英

Array with nested Object in TypeScript?

I'm curious as to how you would do this:

let x = [{}];

in TypepScript. I've looked around and can't find a clear answer to the question. My guess would be you do it using the Array object:

let x : Array<Object> = new Array<Object>;

or

let x : [{}] = [{}];

And using it in this context:

x.push({key: 'text', otherKey: 'text'});

我这样做let x : Object[] = [{}];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM