SD0107
On this page

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
"use typeshade"
@fragment
export function main(@location(0) uv: vec2): vec4 {
const g = uv.x
g = g * 2.
return vec4(g, g, g, 1.)
}

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 CONST_ASSIGN
An assignment to a name that cannot change, such as a const or a read-only resource.

Source

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

Edit this page Report a problem