I am not sure how to do this with TypeScript decorators, but I have a class called GameObject, and I would like my decorators to extend that class, but I also want to extend the decorator target class as well. I am not exactly sure the best approach to do this. I know I can't extend two classes, so what can be done?
export function Camera(options?: CameraOptions) {
return function (target: new () => object) {
return class GameCamera extends target {
}
}
}
export function Prefab(options?: CameraOptions) {
return function (target: new () => object) {
return class GamePrefab extends target {
}
}
}
export class GameObject { }
I would like both classes to extend GameObject, then for GameObject to extend target what would be the best approach?
@Prefab() // Prefab extends GameObejct extends MyPrefab
export class MyPrefab {}
@Camera() // Camera extends GameObejct extends MyCamera
export class MyCamera {}