Skip to content

Import Class Static Methods as Modules

David edited this page Nov 2, 2022 · 3 revisions

image

declare module "math" {
    // import { float2 } from "Mathematics"
    // `import` causes conflicts with the floatX functions 
    // So use the type = import() syntax instead
    type float2 = import("Mathematics").float2
    type float3 = import("Mathematics").float3
    type float4 = import("Mathematics").float4

    export const PI

    export function float2(x: number): float2
    export function float2(x: number, y: number): float2
    export function float3(x: number): float3
    export function float3(x: number, y: number, z: number): float3
    export function float4(x: number): float4
    export function float4(x: number, y: number, z: number, w: number): float4

    export function clamp(v: float, a: float, b: float): float
}