---
title: "construct(): IR builder function in typeshade/core/ir"
description: "construct, an IR builder function in typeshade/core/ir. Low-level TypeName(args) constructor call, the primitive that vec2, vec3…"
url: https://typeshade.dev/api/construct/
language: en
---

# `construct()`

Function in Values

Low-level TypeName(args) constructor call, the primitive that `vec2`, `vec3`, `vec2f64` and a struct's .construct({...}) all build on.

`import { construct } from 'typeshade/core/ir'`

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

## Syntax

```ts
const construct: <T extends ShaderType>(
  type: T,
  args: NodeLike[],
) => Node<KeyOf<T>>
```

## Parameters

**`type` `T extends ShaderType`**

**`args` `NodeLike[]`**

## Return value

`Node<KeyOf<T>>`

## Description

A bare-number argument lifts to the constructed type’s element scalar. Call it directly only for a `ShaderType` those named helpers do not cover; ordinary authoring uses the typed wrapper.

## Examples

### Example

```ts
import { construct, vec3fT } from 'typeshade/core/ir'

const v = construct(vec3fT, [1, 0, 0])  // same result as vec3(1, 0, 0)
```

## See also

- [`vec2`](https://typeshade.dev/api/vec2/)
- [`vec3`](https://typeshade.dev/api/vec3/)
- [`vec2f64`](https://typeshade.dev/api/vec2f64/)

## Source

[`src/core/ir/node.ts`, line 2172](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/node.ts#L2172), at commit af54ddad5
