isMat
On this page

isMat()

Function in Types

Narrows a ShaderType to the { kind: 'mat' } arm.

import { isMat } from 'typeshade'

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

Syntax

const isMat: (t: ShaderType) => t is Extract<ShaderType, { kind: "mat"; }>

Parameters

t ShaderType

Return value

t is Extract<ShaderType, { kind: 'mat' }>

Description

Narrows a ShaderType to the { kind: 'mat' } arm. It matches both elem: 'f32' (native matNxN<f32>) and elem: 'f64' (emulated, emitted as a struct of double-double columns); use isMat64 when the distinction matters. Binary-op type resolution checks it before a matrix-vector or matrix-matrix product.

Examples

Example

import { isMat, mat4x4fT, mat2f64T } from 'typeshade'
isMat(mat4x4fT) // true
isMat(mat2f64T) // also true; use isMat64 to tell them apart

See also

Source

src/core/ir/types.ts, line 1106, at commit 26de7be8

Edit this page Report a problem