---
title: "FnParamSpec: type in Authoring, TypeShade API reference"
description: "FnParamSpec, a type in Authoring. The parameter record fn() accepts. The builder a shader is written with: modules, functions, variables and control flow."
url: https://typeshade.dev/api/fnparamspec/
language: en
---

# `FnParamSpec`

Type in Authoring

The parameter record fn() accepts.

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

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

## Syntax

```ts
type FnParamSpec = Record<string, ShaderType | ParamAttr | StructParamHandle>;
```

## Description

Each key is a parameter name and each value is one of three things: a plain [`ShaderType`](https://typeshade.dev/api/shadertype/) for an ordinary parameter; a [`builtin`](https://typeshade.dev/api/builtin/) or [`location`](https://typeshade.dev/api/location/) spec for an entry-point parameter that carries a stage attribute; or a [`structDecl`](https://typeshade.dev/api/structdecl/) / [`ioStruct`](https://typeshade.dev/api/iostruct/) handle, in which case the body receives that struct’s typed field proxy. One record shape covers plain helpers and `@vertex`, `@fragment` and `@compute` entries alike. See [`FnHandle`](https://typeshade.dev/api/fnhandle/) for the call surface a record produces.

## Examples

### Example

```ts
import { type FnParamSpec } from 'typeshade'
import { fn, builtin, toF32, vec4, u32T, vec4fT } from 'typeshade/core/ir'

const vs = fn(
  'vs_main',
  { idx: builtin('vertex_index', u32T) } satisfies FnParamSpec,
  ({ idx }) => vec4(toF32(idx), 0, 0, 1),
  { stage: 'vertex', retAttr: builtin('position', vec4fT) },
)
```

## See also

- [`ShaderType`](https://typeshade.dev/api/shadertype/)
- [`builtin`](https://typeshade.dev/api/builtin/)
- [`location`](https://typeshade.dev/api/location/)
- [`structDecl`](https://typeshade.dev/api/structdecl/)
- [`ioStruct`](https://typeshade.dev/api/iostruct/)
- [`FnHandle`](https://typeshade.dev/api/fnhandle/)
- [`fn`](https://typeshade.dev/api/fn/)

## Source

[`src/core/ir/builder.ts`, line 86](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/builder.ts#L86), at commit af54ddad5
