---
title: "Resource: interface in Layout, TypeShade API reference"
description: "Resource, an interface in Layout. A single-binding handle: a BindingDecl for module plus a typed access node."
url: https://typeshade.dev/api/resource-interface/
language: en
---

# `Resource`

Interface in Layout

A single-binding handle: a BindingDecl for module plus a typed access node.

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

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

## Syntax

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

## Description

A texture, a sampler or a host-owned uniform has no fields to proxy, so this is all the handle carries. Both [`resource`](https://typeshade.dev/api/resource/) (textures, samplers, any module-owned non-struct binding) and [`hostUniform`](https://typeshade.dev/api/hostuniform/) (a scalar, vector or matrix uniform the host supplies) return it, which is why it is generic over the resource type: `node` keeps the specific `T` (`Node<'texture_2d<f32>'>`, `Node<'sampler'>`, `Node<'vec4<f32>'>`), so type-specific operations (`textureSample`, `.mul`) stay type-checked at the call site.

## Instance properties

**`binding` read only `BindingDecl`**

The binding declaration, for `module({ bindings })`.

**`node` read only `Node<KeyOf<T>>`**

The typed access node, keyed by the declared type `T`.

## See also

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

## Source

[`src/core/sot.ts`, line 816](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/sot.ts#L816), at commit af54ddad5
