class BaseComponent<T> {
data: T
constructor(props: T) {
this.data = props
}
}
interface IExample {
text: string
num: number
obj: object
}
class MyComponent extends BaseComponent<IExample> {
data:IExample ={
text:'',
num:1,
obj:{}
}
}
const gg = new MyComponent({
text:'',
num:1,
obj:{}
})
console.log(gg.data)