Skip to content

Commit

Permalink
Add | undefined where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
Methuselah96 committed Nov 30, 2023
1 parent 049b9fd commit 9025e70
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 18 deletions.
2 changes: 1 addition & 1 deletion types/three/examples/jsm/helpers/TextureHelper.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class TextureHelper extends Mesh {
texture: Texture;
type: 'TextureHelper';

constructor(texture: Texture, width?: number, height?: number, depth?: number);
constructor(texture: Texture, width?: number | undefined, height?: number | undefined, depth?: number | undefined);

dispose(): void;
}
4 changes: 2 additions & 2 deletions types/three/examples/jsm/math/Octree.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { Triangle, Box3, Ray, Sphere, Object3D } from '../../../src/Three.js';
import { Capsule } from './Capsule.js';

export class Octree {
box: Box3;
box: Box3 | null | undefined;
bounds: Box3;

subTrees: Octree[];
triangles: Triangle[];

constructor(box?: Box3);
constructor(box?: Box3 | null | undefined);

addTriangle(triangle: Triangle): this;
calcBox(): this;
Expand Down
2 changes: 1 addition & 1 deletion types/three/examples/jsm/postprocessing/HBAOPass.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class HBAOPass extends Pass {

restoreVisibility(): void;

generateNoise(size?: number): DataTexture;
generateNoise(size?: number | undefined): DataTexture;

static OUTPUT: {
Default: 0;
Expand Down
2 changes: 1 addition & 1 deletion types/three/examples/jsm/renderers/common/Renderer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class Renderer {

info: Info;

constructor(backend: Backend, parameters?: { logarithmicDepthBuffer?: boolean });
constructor(backend: Backend, parameters?: { logarithmicDepthBuffer?: boolean | undefined } | undefined);

init(): Promise<void>;

Expand Down
8 changes: 4 additions & 4 deletions types/three/examples/jsm/utils/SortUtils.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export interface RadixSortOptions<T> {
aux?: T[];
get?: (el: T) => number;
reversed?: boolean;
aux?: T[] | undefined;
get?: ((el: T) => number) | undefined;
reversed?: boolean | undefined;
}

export const radixSort: <T = number>(arr: T[], opt?: RadixSortOptions<T>) => void;
export const radixSort: <T = number>(arr: T[], opt?: RadixSortOptions<T> | undefined) => void;
13 changes: 11 additions & 2 deletions types/three/src/objects/BatchedMesh.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
* @param maxIndexCount the max number of indices to be used by all geometries.
* @param material an instance of [page:Material]. Default is a new {@link MeshBasicMaterial}.
*/
constructor(maxGeometryCount: number, maxVertexCount: number, maxIndexCount?: number, material?: Material);
constructor(
maxGeometryCount: number,
maxVertexCount: number,
maxIndexCount?: number | undefined,
material?: Material | undefined,
);

/**
* Computes the bounding box, updating {@link .boundingBox} attribute.
Expand Down Expand Up @@ -147,7 +152,11 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
* geometry. This is necessary if it is planned to set a new geometry at this index at a later time that is larger
* than the original geometry. Defaults to the length of the given geometry index buffer.
*/
addGeometry(geometry: BufferGeometry, reservedVertexRange?: number, reservedIndexRange?: number): number;
addGeometry(
geometry: BufferGeometry,
reservedVertexRange?: number | undefined,
reservedIndexRange?: number | undefined,
): number;

/**
* Replaces the geometry at `index` with the provided geometry. Throws an error if there is not enough space
Expand Down
2 changes: 1 addition & 1 deletion types/three/src/renderers/WebGL1Renderer.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { WebGLRenderer, WebGLRendererParameters } from './WebGLRenderer.js';

export class WebGL1Renderer extends WebGLRenderer {
constructor(parameters?: WebGLRendererParameters);
constructor(parameters?: WebGLRendererParameters | undefined);
readonly isWebGL1Renderer: true;
}
7 changes: 6 additions & 1 deletion types/three/src/renderers/WebGL3DRenderTarget.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ export class WebGL3DRenderTarget extends WebGLRenderTarget {
* @param options optional object that holds texture parameters for an auto-generated target texture and
* depthBuffer/stencilBuffer booleans. See {@link WebGLRenderTarget} for details.
*/
constructor(width?: number, height?: number, depth?: number, options?: WebGLRenderTargetOptions);
constructor(
width?: number | undefined,
height?: number | undefined,
depth?: number | undefined,
options?: WebGLRenderTargetOptions | undefined,
);

/**
* The depth of the render target.
Expand Down
7 changes: 6 additions & 1 deletion types/three/src/renderers/WebGLArrayRenderTarget.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ export class WebGLArrayRenderTarget extends WebGLRenderTarget {
* @param options optional object that holds texture parameters for an auto-generated target texture and
* depthBuffer/stencilBuffer booleans. See {@link WebGLRenderTarget} for details.
*/
constructor(width?: number, height?: number, depth?: number, options?: WebGLRenderTargetOptions);
constructor(
width?: number | undefined,
height?: number | undefined,
depth?: number | undefined,
options?: WebGLRenderTargetOptions | undefined,
);

/**
* The depth of the render target.
Expand Down
2 changes: 1 addition & 1 deletion types/three/src/renderers/WebGLCubeRenderTarget.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Texture } from '../textures/Texture.js';
import { CubeTexture } from '../textures/CubeTexture.js';

export class WebGLCubeRenderTarget extends WebGLRenderTarget {
constructor(size?: number, options?: WebGLRenderTargetOptions);
constructor(size?: number | undefined, options?: WebGLRenderTargetOptions | undefined);

texture: CubeTexture;

Expand Down
7 changes: 6 additions & 1 deletion types/three/src/renderers/WebGLMultipleRenderTargets.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ export class WebGLMultipleRenderTargets extends WebGLRenderTarget<Texture[]> {
* @param options object that holds texture parameters for an auto-generated target texture and depthBuffer/stencilBuffer booleans.
* For an explanation of the texture parameters see {@link Texture}.
*/
constructor(width?: number, height?: number, count?: number, options?: WebGLRenderTargetOptions);
constructor(
width?: number | undefined,
height?: number | undefined,
count?: number | undefined,
options?: WebGLRenderTargetOptions | undefined,
);

readonly isWebGLMultipleRenderTargets: true;
}
6 changes: 5 additions & 1 deletion types/three/src/renderers/WebGLRenderTarget.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import { RenderTarget, RenderTargetOptions } from '../core/RenderTarget.js';
export interface WebGLRenderTargetOptions extends RenderTargetOptions {}

export class WebGLRenderTarget<TTexture extends Texture | Texture[] = Texture> extends RenderTarget<TTexture> {
constructor(width?: number, height?: number, options?: WebGLRenderTargetOptions);
constructor(
width?: number | undefined,
height?: number | undefined,
options?: WebGLRenderTargetOptions | undefined,
);

readonly isWebGLRenderTarget: true;
}
2 changes: 1 addition & 1 deletion types/three/src/renderers/WebGLRenderer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class WebGLRenderer implements Renderer {
* The constructor also accepts no parameters at all.
* In all cases, it will assume sane defaults when parameters are missing.
*/
constructor(parameters?: WebGLRendererParameters);
constructor(parameters?: WebGLRendererParameters | undefined);

/**
* A Canvas where the renderer draws its output.
Expand Down

0 comments on commit 9025e70

Please sign in to comment.