From 51e62e282fcbe81e2654ce621c6d0bf5614e33fa Mon Sep 17 00:00:00 2001 From: bzztbomb Date: Fri, 8 May 2026 11:55:30 -0700 Subject: [PATCH] [three] Make DepthTexture generic and have CubeDepthTexture extend it so that isDepthTexture and other DepthTexture members are properly inherited. --- types/three/src/textures/CubeDepthTexture.d.ts | 5 ++--- types/three/src/textures/DepthTexture.d.ts | 2 +- types/three/test/unit/src/textures/CubeDepthTexture.ts | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/types/three/src/textures/CubeDepthTexture.d.ts b/types/three/src/textures/CubeDepthTexture.d.ts index 9997be9ee..ebc952c30 100644 --- a/types/three/src/textures/CubeDepthTexture.d.ts +++ b/types/three/src/textures/CubeDepthTexture.d.ts @@ -6,10 +6,9 @@ import { TextureDataType, Wrapping, } from "../constants.js"; -import { DepthTextureImageData } from "./DepthTexture.js"; -import { Texture } from "./Texture.js"; +import { DepthTexture, DepthTextureImageData } from "./DepthTexture.js"; -declare class CubeDepthTexture extends Texture { +declare class CubeDepthTexture extends DepthTexture { readonly isCubeDepthTexture: true; readonly isCubeTexture: true; diff --git a/types/three/src/textures/DepthTexture.d.ts b/types/three/src/textures/DepthTexture.d.ts index 63dbe3650..bbac8c61a 100644 --- a/types/three/src/textures/DepthTexture.d.ts +++ b/types/three/src/textures/DepthTexture.d.ts @@ -15,7 +15,7 @@ import { Texture } from "./Texture.js"; * @see {@link https://threejs.org/docs/index.html#api/en/textures/DepthTexture | Official Documentation} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/DepthTexture.js | Source} */ -export class DepthTexture extends Texture { +export class DepthTexture extends Texture { /** * Create a new instance of {@link DepthTexture} * @param width Width of the texture. diff --git a/types/three/test/unit/src/textures/CubeDepthTexture.ts b/types/three/test/unit/src/textures/CubeDepthTexture.ts index 2c7255b4e..e82d8bc8c 100644 --- a/types/three/test/unit/src/textures/CubeDepthTexture.ts +++ b/types/three/test/unit/src/textures/CubeDepthTexture.ts @@ -3,4 +3,5 @@ import * as THREE from "three"; const texture = new THREE.CubeDepthTexture(512); texture.isCubeDepthTexture; // $ExpectType true texture.isCubeTexture; // $ExpectType true +texture.isDepthTexture; // $ExpectType true texture.images; // $ExpectType CubeDepthTextureImageData