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:
"use typeshade"
@fragmentexport function main(uv: location<0, 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
-
TS8005CONST_ASSIGN - An assignment to a name or a place that cannot change: a
constnumber or vector, a component of aconstvector or matrix, areadonlyfield or static, or a storage binding thatreadonlyor"read"promises is never written. A write to a field or an element of aconstobject is not one of these, because theconstholds the object and the object stays writable, as in JavaScript (Rule 6.10).
Source
Where the compiler raises this code at commit af54ddad5, one line per file: