Clean up code and enable strict TS

This commit is contained in:
Andras Schmelczer 2026-05-04 10:16:28 +01:00
parent f350b1ff37
commit 0735dd764f
21 changed files with 124 additions and 119 deletions

View file

@ -41,6 +41,6 @@ export class DeltaTimeCalculator {
}
public get fps() {
return 1 / this.deltaTimeAccumulator;
return this.deltaTimeAccumulator ? 1 / this.deltaTimeAccumulator : 0;
}
}

View file

@ -30,7 +30,7 @@ export class ErrorHandler {
}
public static addMetadata(key: string, value: any) {
const serialized = {};
const serialized: Record<string, any> = {};
for (const k in value) {
serialized[k] = value[k];
}

View file

@ -83,5 +83,5 @@ export const generateNoise = ({
textureCache.set(cacheKey, colorTexture);
}
return textureCache.get(cacheKey).createView();
return textureCache.get(cacheKey)!.createView();
};

View file

@ -3,8 +3,8 @@ import { vec2 } from 'gl-matrix';
import { CopyPipeline } from '../../pipelines/copy/copy-pipeline';
export class ResizableTexture {
private texture: GPUTexture;
private textureView: GPUTextureView;
private texture!: GPUTexture;
private textureView!: GPUTextureView;
private readonly copyPipeline: CopyPipeline;
private size: vec2 | null = null;
@ -35,7 +35,7 @@ export class ResizableTexture {
const newTextureView = newTexture.createView();
if (this.textureView) {
if (this.size) {
const commandEncoder = this.device.createCommandEncoder();
this.copyPipeline.execute(
commandEncoder,