---
title: "isMat(): function in Types, TypeShade API reference"
description: "isMat, a function in Types. Narrows a ShaderType to the { kind: 'mat' } arm."
url: https://typeshade.dev/api/ismat/
language: en
---

# `isMat()`

Function in Types

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

`import { isMat } from 'typeshade'`
`import { isMat } from 'typeshade/core/ir'`

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

## Syntax

```ts
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`](https://typeshade.dev/api/ismat64/) when the distinction matters. Binary-op type resolution checks it before a matrix-vector or matrix-matrix product.

## Examples

### Example

```ts
import { isMat } from 'typeshade'
import { mat4x4fT, mat2f64T } from 'typeshade/core/ir'

isMat(mat4x4fT) // true
isMat(mat2f64T) // also true; use isMat64 to tell them apart
```

## See also

- [`isMat64`](https://typeshade.dev/api/ismat64/)

## Source

[`src/core/ir/types/predicates.ts`, line 57](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/types/predicates.ts#L57), at commit af54ddad5
