---
title: "lift(): function in IR, TypeShade API reference"
description: "lift, a function in IR. Normalizes a NodeLike operand to a ReadonlyNode: a JS number becomes an f32 literal, and an existing node passes through unchanged."
url: https://typeshade.dev/api/lift/
language: en
---

# `lift()`

Function in IR

Normalizes a NodeLike operand to a ReadonlyNode: a JS number becomes an `f32` literal, and an existing node passes through unchanged.

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

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

## Syntax

```ts
function lift(x: NodeLike): ReadonlyNode<string>
```

## Parameters

**`x` `NodeLike`**

## Return value

`ReadonlyNode<string>`

## Description

Every free-function builtin (`sin`, `min`, `construct`, …) sends its operands through this, which is why `sin(1)` works without an explicit `f32(1)`. Call it directly only when writing a new builtin wrapper that needs a plain node from a `NodeLike` argument. Method operands take a different path: a bare number passed to a method lifts to the receiver’s own scalar kind (`u32`, `i32` or `f64`), so `u32node.add(1)` emits an unsigned literal.

## Examples

### Example

```ts
import { lift, f32 } from 'typeshade/core/ir'

lift(2)       // Node<'f32'>: 2 lifted to an f32 literal
lift(f32(2))  // the same node, passed through unchanged
```

## See also

- [`NodeLike`](https://typeshade.dev/api/nodelike/)
- [`ReadonlyNode`](https://typeshade.dev/api/readonlynode/)

## Source

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