---
title: "wgslType(): function in Emit, TypeShade API reference"
description: "wgslType, a function in Emit. Spell a ShaderType as WGSL type syntax. The WGSL and GLSL ES 3.00 writers, module fragments and the passes that run before them."
url: https://typeshade.dev/api/wgsltype/
language: en
---

# `wgslType()`

Function in Emit

Spell a ShaderType as WGSL type syntax.

`import { wgslType } from 'typeshade'`

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

## Syntax

```ts
function wgslType(t: ShaderType): string
```

## Parameters

**`t` `ShaderType`**

## Return value

`string`

## Exceptions

**[`SD0040`](https://typeshade.dev/reference/errors/sd0040/)**

[`SD0040`](https://typeshade.dev/reference/errors/sd0040/) if `t` is an `f64` or `vec64` type, or a matrix of `f64`. Those types exist only before the double-precision lowering pass ([`fp64Lower`](https://typeshade.dev/api/fp64lower/), which every emit runs) rewrites them to `vec2<f32>` and the `DF64` struct types. Reaching one here means that pass did not run, and the error is raised so a shader never ships with its double precision quietly reduced to single precision.

## See also

- [`ShaderType`](https://typeshade.dev/api/shadertype/)
- [`fp64Lower`](https://typeshade.dev/api/fp64lower/)

## Source

[`src/core/backends/wgsl/spelling.ts`, line 14](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/backends/wgsl/spelling.ts#L14), at commit af54ddad5
