I'm encountering an issue:
class Collection<T extends IModel> extends Event implements ICollection<T> {
constructor(array: any[] = []) {
super()
this._init(array)
}
private _init(array: any[]) {
array.forEach((object) => {
if (this._isModel(object)) {
return console.log("hey")
}
const model = new T(object)
})
}
The line "const model = new T(object)" is throwing an error:
error TS2693: 'T' only refers to a type, but is being used as a value here.
Does anyone have a solution for creating a new instance of T?