From 1e92ed8b3dc05eb64ecb00306c26de026826d421 Mon Sep 17 00:00:00 2001 From: yzrmn Date: Wed, 20 Nov 2024 15:23:36 +0100 Subject: [PATCH] Add explicit types to exported constants --- packages/redgeometry-app/src/ecs-modules/camera.ts | 2 +- packages/redgeometry-app/src/ecs-modules/mesh.ts | 2 +- packages/redgeometry/src/core/path-options.ts | 8 ++++---- packages/redgeometry/src/utility/debug.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/redgeometry-app/src/ecs-modules/camera.ts b/packages/redgeometry-app/src/ecs-modules/camera.ts index b4803a9..2eaf3bb 100644 --- a/packages/redgeometry-app/src/ecs-modules/camera.ts +++ b/packages/redgeometry-app/src/ecs-modules/camera.ts @@ -4,7 +4,7 @@ import type { World } from "../ecs/world.js"; import type { ComputedTransformComponent, TransformComponent } from "./transform.js"; export type CameraBundle = [CameraComponent, TransformComponent]; -export const CAMERA_BUNDLE_IDS = ["camera", "transform"] satisfies ComponentIdsOf; +export const CAMERA_BUNDLE_IDS: ComponentIdsOf = ["camera", "transform"]; export type CameraComponent = { componentId: "camera"; diff --git a/packages/redgeometry-app/src/ecs-modules/mesh.ts b/packages/redgeometry-app/src/ecs-modules/mesh.ts index 99806d0..1fdf536 100644 --- a/packages/redgeometry-app/src/ecs-modules/mesh.ts +++ b/packages/redgeometry-app/src/ecs-modules/mesh.ts @@ -13,7 +13,7 @@ import MESH_WGSL from "./shader/mesh.wgsl"; import { transformSystem, type ComputedTransformComponent, type TransformComponent } from "./transform.js"; export type MeshBundle = [MeshComponent, MaterialComponent, TransformComponent]; -export const MESH_BUNDLE_IDS = ["mesh", "material", "transform"] satisfies ComponentIdsOf; +export const MESH_BUNDLE_IDS: ComponentIdsOf = ["mesh", "material", "transform"]; const MESH_MAX_ENTRIES_PER_MATERIAL = 50000; diff --git a/packages/redgeometry/src/core/path-options.ts b/packages/redgeometry/src/core/path-options.ts index 4484b40..3ccc913 100644 --- a/packages/redgeometry/src/core/path-options.ts +++ b/packages/redgeometry/src/core/path-options.ts @@ -130,12 +130,12 @@ export const DEFAULT_PATH_CLIP_OPTIONS: Readonly = { }; // Threshold for acute (179.9999 degrees) and obtuse (0.0001 degrees) angles. -export const COS_ACUTE = -0.99999999999847689; -export const COS_OBTUSE = 0.99999999999847689; +export const COS_ACUTE: number = -0.99999999999847689; +export const COS_OBTUSE: number = 0.99999999999847689; // Threshold for curve splitting (to avoid tiny tail curves). -export const MIN_PARAMETER = 5e-7; -export const MAX_PARAMETER = 1 - MIN_PARAMETER; +export const MIN_PARAMETER: number = 5e-7; +export const MAX_PARAMETER: number = 1 - MIN_PARAMETER; export function createPathFlatten(options: PathQualityOptions): PathFlatten2 { switch (options.flattenMode) { diff --git a/packages/redgeometry/src/utility/debug.ts b/packages/redgeometry/src/utility/debug.ts index b9fbe1e..6858522 100644 --- a/packages/redgeometry/src/utility/debug.ts +++ b/packages/redgeometry/src/utility/debug.ts @@ -2,7 +2,7 @@ import { Log } from "./log.js"; import { formatString, type FormatParameters } from "./string.js"; // Global log object -export const log = new Log({ +export const log: Log = new Log({ errorFn: console.error, warnFn: console.warn, infoFn: console.info,