---
title: "FieldSpec: interface in Layout, TypeShade API reference"
description: "FieldSpec, an interface in Layout. One struct field or entry-point parameter carrying a stage attribute."
url: https://typeshade.dev/api/fieldspec/
language: en
---

# `FieldSpec`

Interface in Layout

One struct field or entry-point parameter carrying a stage attribute.

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

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

## Syntax

```ts
interface FieldSpec<T extends ShaderType = ShaderType> {
  readonly type: T;
  readonly attr: string;
  readonly location?: number;
  readonly builtin?: string;
  readonly interpolate?: string;
}
```

## Description

One struct field or entry-point parameter carrying a stage attribute. It is the return type of [`builtin`](https://typeshade.dev/api/builtin/) and [`location`](https://typeshade.dev/api/location/), and the value type of both an [`ioStruct`](https://typeshade.dev/api/iostruct/) field map and an [`fn`](https://typeshade.dev/api/fn/) entry-point parameter record, so a stage-attributed parameter and an IO-struct field are written the same way.

`attr` is the attribute as WGSL text. `location`, `builtin` and `interpolate` are the structured form the backends read, for capability checks, for the vertex-attribute table [`reflect`](https://typeshade.dev/api/reflect/) produces, and for the GLSL `flat` qualifier. A field carries either a builtin attribute or a location attribute, never both. Build one with `builtin(name, type)` or `location(n, type, interpolate?)`.

## Instance properties

**`type` read only `T`**

The field’s shader type.

**`attr` read only `string`**

The attribute as WGSL text. The structured fields below are what the backends read.

**`location` optional read only `number`**

The `@location(n)` slot, when the field is location-attributed.

**`builtin` optional read only `string`**

The `@builtin(name)` id, when the field is builtin-attributed.

**`interpolate` optional read only `string`**

The `@interpolate(mode)` mode, when one was given.

## See also

- [`builtin`](https://typeshade.dev/api/builtin/)
- [`location`](https://typeshade.dev/api/location/)
- [`ioStruct`](https://typeshade.dev/api/iostruct/)
- [`fn`](https://typeshade.dev/api/fn/)
- [`reflect`](https://typeshade.dev/api/reflect/)

## Source

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