---
title: "TexelKey: type in Types, TypeShade API reference"
description: "TexelKey, a type in Types. The vec4<…> key a texel load from texture key K yields: the loaded element is the element in the texture key…"
url: https://typeshade.dev/api/texelkey/
language: en
---

# `TexelKey`

Type in Types

The `vec4<…>` key a texel load from texture key K yields: the loaded element is the element in the texture key, so `texture_2d`<`u32`> loads a `vec4<u32>`.

`import type { TexelKey } from 'typeshade'`
`import type { TexelKey } from 'typeshade/core/ir'`

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

## Syntax

```ts
type TexelKey<K extends string> = K extends `${string}<${infer E}>` ? `vec4<${E}>` : never;
```

## Description

Deriving it from the key keeps the result type and the texture in step; a `vec4<f32>` result from an integer texture, which both GPU compilers reject, cannot be written with [`textureLoad`](https://typeshade.dev/api/textureload/).

## See also

- [`textureLoad`](https://typeshade.dev/api/textureload/)

## Source

[`src/core/ir/node.ts`, line 1869](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/node.ts#L1869), at commit af54ddad5
