---
title: "SD0107: assignment to an immutable 'let' binding"
description: "SD0107, an error code of the TypeShade compiler. assignment to an immutable 'let' binding"
url: https://typeshade.dev/reference/errors/sd0107/
language: en
---

# `SD0107`

Core code

assignment to an immutable 'let' binding

The registry text and every compiler message on these pages are the compiler's own English.

## In the front end

A `"use typeshade"` file never reaches this check with the same mistake: the front end refuses it first, under its own code. This program, compiled at build time, gets:

example.shade.ts

```ts
"use typeshade"

@fragment
export function main(uv: location<0, vec2>): vec4 {
  const g = uv.x
  g = g * 2.
  return vec4(g, g, g, 1.)
}
```

**[TS8005](https://typeshade.dev/reference/errors/ts8005/)** error, line 6: Cannot assign to "g" — it is declared with const.

## How to fix it

The registry's hint: declare the binding with Var() instead of Let() to mutate it

## See also

**[`TS8005`](https://typeshade.dev/reference/errors/ts8005/) `CONST_ASSIGN`**

An assignment to a name or a place that cannot change: a `const` number or vector, a component of a `const` vector or matrix, a `readonly` field or static, or a storage binding that `readonly` or `"read"` promises is never written. A write to a field or an element of a `const` object is not one of these, because the `const` holds the object and the object stays writable, as in JavaScript ([Rule 6.10](https://typeshade.dev/reference/rules/6-10/)).

- [Diagnostics](https://typeshade.dev/guide/internals/diagnostics/)
- [`TypeShadeError`](https://typeshade.dev/api/typeshadeerror/)
- [Error codes](https://typeshade.dev/reference/errors/)

## Source

Where the compiler raises this code at commit af54ddad5, one line per file:

- [`src/core/passes/lint/rules/no-assign-to-let.ts:65`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/passes/lint/rules/no-assign-to-let.ts#L65)
