---
title: "TexelKey: TypeShade 셰이더 API의 타입 분류 타입 참조 문서"
description: "TexelKey, TypeShade API의 타입 분류에 속하는 타입입니다. 텍스처 키 K에서 텍셀 로드를 하면 나오는 vec4<…> 키입니다."
url: https://typeshade.dev/ko/api/texelkey/
language: ko
---

# `TexelKey`

타입, 타입 분류

텍스처 키 K에서 텍셀 로드를 하면 나오는 `vec4<…>` 키입니다. 불러온 원소는 텍스처 키의 원소이므로, `texture_2d`<`u32`>를 로드하면 `vec4<u32>`가 나옵니다.

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

설명은 커밋 af54ddad5의 검토된 컴파일러 문서를 번역한 것입니다. 시그니처와 예제 코드는 원문을 따르며, 필요한 경우 설명에 편집상 수정이 반영됩니다.

## 구문

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

## 설명

키에서 이 타입을 유도하면 결과 타입과 텍스처가 서로 어긋나지 않습니다. 정수 텍스처에서 `vec4<f32>` 결과를 얻는 것은 두 GPU 컴파일러가 모두 거부하므로, [`textureLoad`](https://typeshade.dev/ko/api/textureload/)로는 그런 결과를 만들 수 없습니다.

## 함께 보기

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

## 소스

[`src/core/ir/node.ts`, 1869행](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/node.ts#L1869), 커밋 af54ddad5 기준
