import Helper from '@ember/component/helper'; import { BaseTexture } from '@babylonjs/core/Materials/Textures/baseTexture'; interface TextureConstructor { new (...args: unknown[]): T; } export default class CustomTextureHelper extends Helper { texture?: T; compute( [clazz, ...args]: [ TextureConstructor, ConstructorParameters> ], textureOptions: Partial ): T { if (this.texture) { this.texture.dispose(); } this.texture = new clazz(...args); Object.assign(this.texture, textureOptions); return this.texture; } willDestroy(): void { if (this.texture) { this.texture.dispose(); } super.willDestroy(); } }