From 8ad42182fb22ab1c9edbcf6a0a27530b0f34898e Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sun, 30 Jul 2023 17:54:56 -0400 Subject: [PATCH] Remove types.d.ts --- types/three/src/core/BufferGeometry.d.ts | 3 +-- types/three/src/core/RenderTarget.d.ts | 8 +------- types/three/src/core/UniformsGroup.d.ts | 3 +-- types/three/src/materials/Material.d.ts | 3 +-- types/three/src/objects/InstancedMesh.d.ts | 14 ++++++-------- types/three/src/textures/Texture.d.ts | 3 +-- types/three/src/types.d.ts | 13 ------------- 7 files changed, 11 insertions(+), 36 deletions(-) delete mode 100644 types/three/src/types.d.ts diff --git a/types/three/src/core/BufferGeometry.d.ts b/types/three/src/core/BufferGeometry.d.ts index 2b7108a29..ecab628bc 100644 --- a/types/three/src/core/BufferGeometry.d.ts +++ b/types/three/src/core/BufferGeometry.d.ts @@ -8,7 +8,6 @@ import { Vector2 } from '../math/Vector2.js'; import { Vector3 } from '../math/Vector3.js'; import { EventDispatcher } from './EventDispatcher.js'; import { GLBufferAttribute } from './GLBufferAttribute.js'; -import { DisposableEventMap } from '../types.js'; export type NormalBufferAttributes = Record; export type NormalOrGLBufferAttributes = Record< @@ -76,7 +75,7 @@ export type NormalOrGLBufferAttributes = Record< */ export class BufferGeometry< Attributes extends NormalOrGLBufferAttributes = NormalBufferAttributes, -> extends EventDispatcher { +> extends EventDispatcher<{ dispose: {} }> { /** * This creates a new {@link THREE.BufferGeometry | BufferGeometry} object. */ diff --git a/types/three/src/core/RenderTarget.d.ts b/types/three/src/core/RenderTarget.d.ts index f15c26ab6..8d43beaa0 100644 --- a/types/three/src/core/RenderTarget.d.ts +++ b/types/three/src/core/RenderTarget.d.ts @@ -10,7 +10,6 @@ import { MagnificationTextureFilter, ColorSpace, } from '../constants.js'; -import { Disposable, DisposableEventMap } from '../types.js'; export interface RenderTargetOptions { wrapS?: Wrapping | undefined; @@ -34,12 +33,7 @@ export interface RenderTargetOptions { encoding?: TextureEncoding | undefined; } -/* tslint:disable:one-line */ -export class RenderTarget - extends EventDispatcher - implements Disposable -{ - /* tslint:enable:one-line */ +export class RenderTarget extends EventDispatcher<{ dispose: {} }> { constructor(width?: number, height?: number, options?: RenderTargetOptions); readonly isRenderTarget: true; diff --git a/types/three/src/core/UniformsGroup.d.ts b/types/three/src/core/UniformsGroup.d.ts index 554ece97d..4df29ac4c 100644 --- a/types/three/src/core/UniformsGroup.d.ts +++ b/types/three/src/core/UniformsGroup.d.ts @@ -1,13 +1,12 @@ import { EventDispatcher } from './EventDispatcher.js'; import { Uniform } from './Uniform.js'; import { Usage } from '../constants.js'; -import { Disposable, DisposableEventMap } from '../types.js'; /** * @see Example: {@link https://threejs.org/examples/#webgl2_ubo | WebGL2 / UBO} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/UniformsGroup.js | Source} */ -export class UniformsGroup extends EventDispatcher implements Disposable { +export class UniformsGroup extends EventDispatcher<{ dispose: {} }> { constructor(); readonly isUniformsGroup: true; diff --git a/types/three/src/materials/Material.d.ts b/types/three/src/materials/Material.d.ts index 3f4313938..0846c1984 100644 --- a/types/three/src/materials/Material.d.ts +++ b/types/three/src/materials/Material.d.ts @@ -13,7 +13,6 @@ import { StencilOp, PixelFormat, } from '../constants.js'; -import { Disposable, DisposableEventMap } from '../types.js'; export interface MaterialParameters { alphaHash?: boolean | undefined; @@ -64,7 +63,7 @@ export interface MaterialParameters { /** * Materials describe the appearance of objects. They are defined in a (mostly) renderer-independent way, so you don't have to rewrite materials if you decide to use a different renderer. */ -export class Material extends EventDispatcher implements Disposable { +export class Material extends EventDispatcher<{ dispose: {} }> { constructor(); alphaHash: boolean; diff --git a/types/three/src/objects/InstancedMesh.d.ts b/types/three/src/objects/InstancedMesh.d.ts index eaee3154b..9c36b6532 100644 --- a/types/three/src/objects/InstancedMesh.d.ts +++ b/types/three/src/objects/InstancedMesh.d.ts @@ -7,10 +7,11 @@ import { Color } from '../math/Color.js'; import { Object3DEventMap } from '../core/Object3D.js'; import { Box3 } from '../math/Box3.js'; import { Sphere } from '../math/Sphere.js'; -import { Disposable, DisposableEventMap } from '../types.js'; import { BaseEvent, EventListener, EventTypeValidator } from '../core/EventDispatcher.js'; -export interface InstancedMeshEventMap extends Object3DEventMap, DisposableEventMap {} +export interface InstancedMeshEventMap extends Object3DEventMap { + dispose: {}; +} /** * A special version of {@link THREE.Mesh | Mesh} with instanced rendering support @@ -27,12 +28,9 @@ export interface InstancedMeshEventMap extends Object3DEventMap, DisposableEvent */ /* tslint:disable:one-line */ export class InstancedMesh< - TGeometry extends BufferGeometry = BufferGeometry, - TMaterial extends Material | Material[] = Material | Material[], - > - extends Mesh - implements Disposable -{ + TGeometry extends BufferGeometry = BufferGeometry, + TMaterial extends Material | Material[] = Material | Material[], +> extends Mesh { /* tslint:enable:one-line */ /** * Create a new instance of {@link InstancedMesh} diff --git a/types/three/src/textures/Texture.d.ts b/types/three/src/textures/Texture.d.ts index f9bd06cab..98115d631 100644 --- a/types/three/src/textures/Texture.d.ts +++ b/types/three/src/textures/Texture.d.ts @@ -15,7 +15,6 @@ import { AnyMapping, ColorSpace, } from '../constants.js'; -import { DisposableEventMap, Disposable } from '../types.js'; /** Shim for OffscreenCanvas. */ // tslint:disable-next-line:no-empty-interface @@ -39,7 +38,7 @@ export interface OffscreenCanvas extends EventTarget {} * @see {@link https://threejs.org/docs/index.html#api/en/textures/Texture | Official Documentation} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/Textures/Texture.js | Source} */ -export class Texture extends EventDispatcher implements Disposable { +export class Texture extends EventDispatcher<{ dispose: {} }> { /** * This creates a new {@link THREE.Texture | Texture} object. * @param image See {@link Texture.image | .image}. Default {@link THREE.Texture.DEFAULT_IMAGE} diff --git a/types/three/src/types.d.ts b/types/three/src/types.d.ts deleted file mode 100644 index 7be7a2c40..000000000 --- a/types/three/src/types.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { EmptyEvent } from './Three.js'; - -export interface DisposableEventMap { - dispose: EmptyEvent; -} - -export interface Disposable { - /** - * Frees resources allocated by this instance. - * @remarks Call this method whenever this instance is no longer used in your app. - */ - dispose(): void; -}