Skip to content

Commit d2eab99

Browse files
authored
[three] Make DepthTexture generic and have CubeDepthTexture extend it so that (#2148)
isDepthTexture and other DepthTexture members are properly inherited.
1 parent c526380 commit d2eab99

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

types/three/src/textures/CubeDepthTexture.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ import {
66
TextureDataType,
77
Wrapping,
88
} from "../constants.js";
9-
import { DepthTextureImageData } from "./DepthTexture.js";
10-
import { Texture } from "./Texture.js";
9+
import { DepthTexture, DepthTextureImageData } from "./DepthTexture.js";
1110

12-
declare class CubeDepthTexture extends Texture<CubeDepthTextureImageData> {
11+
declare class CubeDepthTexture extends DepthTexture<CubeDepthTextureImageData> {
1312
readonly isCubeDepthTexture: true;
1413
readonly isCubeTexture: true;
1514

types/three/src/textures/DepthTexture.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { Texture } from "./Texture.js";
1515
* @see {@link https://threejs.org/docs/index.html#api/en/textures/DepthTexture | Official Documentation}
1616
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/DepthTexture.js | Source}
1717
*/
18-
export class DepthTexture extends Texture<DepthTextureImageData> {
18+
export class DepthTexture<TImage = DepthTextureImageData> extends Texture<TImage> {
1919
/**
2020
* Create a new instance of {@link DepthTexture}
2121
* @param width Width of the texture.

types/three/test/unit/src/textures/CubeDepthTexture.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ import * as THREE from "three";
33
const texture = new THREE.CubeDepthTexture(512);
44
texture.isCubeDepthTexture; // $ExpectType true
55
texture.isCubeTexture; // $ExpectType true
6+
texture.isDepthTexture; // $ExpectType true
67
texture.images; // $ExpectType CubeDepthTextureImageData

0 commit comments

Comments
 (0)