Can i define Class of objects that are stored in array? Similar to
ArrayList<? extends E> array = new ArrayList<?>()
Im trying to do something like this:
let myArray = new Array(SomeClass)
but it's only pushing a class as first object, funny my IDE shows me, that objects in this Array are of SomeClass
Just add the type definition to the variable.
let myArray: SomeClass[] = [];
TypeScript Playground for this
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.