---
title: "Resource: TypeShade 셰이더 API의 레이아웃 분류 인터페이스 참조 문서"
description: "Resource, TypeShade API의 레이아웃 분류에 속하는 인터페이스입니다. 단일 바인딩 핸들입니다. module에 넘기는 BindingDecl과 타입이 지정된 접근 노드를 함께 담습니다."
url: https://typeshade.dev/ko/api/resource-interface/
language: ko
---

# `Resource`

인터페이스, 레이아웃 분류

단일 바인딩 핸들입니다. module에 넘기는 BindingDecl과 타입이 지정된 접근 노드를 함께 담습니다.

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

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

## 구문

```ts
interface Resource<T extends ShaderType = ShaderType> {
  readonly binding: BindingDecl;
  readonly node: Node<KeyOf<T>>;
}
```

## 설명

텍스처, 샘플러, 호스트가 소유하는 유니폼에는 프록시할 필드가 없으므로, 핸들이 담는 것은 이것이 전부입니다. [`resource`](https://typeshade.dev/ko/api/resource/)(텍스처, 샘플러, 모듈이 소유하는 구조체가 아닌 모든 바인딩)와 [`hostUniform`](https://typeshade.dev/ko/api/hostuniform/)(호스트가 제공하는 스칼라, 벡터, 행렬 유니폼) 모두 이 핸들을 반환합니다. 그래서 이 타입은 리소스 타입을 받는 제네릭입니다. `node`는 구체적인 `T`를 유지한다(`Node<'texture_2d<f32>'>`, `Node<'sampler'>`, `Node<'vec4<f32>'>`). 그러므로 타입에 따라 달라지는 연산(`textureSample`, `.mul`)도 호출 지점에서 계속 타입 검사를 받습니다.

## 인스턴스 속성

**`binding` 읽기 전용 `BindingDecl`**

`module({ bindings })`에 넘기는 바인딩 선언입니다.

**`node` 읽기 전용 `Node<KeyOf<T>>`**

선언된 타입 `T`를 키로 쓰는, 타입이 지정된 접근 노드입니다.

## 함께 보기

- [`resource`](https://typeshade.dev/ko/api/resource/)
- [`hostUniform`](https://typeshade.dev/ko/api/hostuniform/)

## 소스

[`src/core/sot.ts`, 816행](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/sot.ts#L816), 커밋 af54ddad5 기준
