TS8016
Front-end code INDEX_OOB
A constant index outside the length of what it indexes.
The registry has no documentation comment for this constant, so the line above is written by this site from the messages the compiler raises it with.
The registry text and every compiler message on these pages are the compiler's own English.
Example
"use typeshade"
@fragmentexport function main(@location(0) uv: vec2): vec4 { const w = array<f32, 3>(0.2, 0.5, 0.3) return vec4(uv, w[3], 1.)}Compiled at build time against the pinned compiler, this program gets:
TS8016 error, line 6: Index 3 is out of range for length 3.
How to fix it
The same program, corrected. It compiles with no diagnostic.
"use typeshade"
@fragmentexport function main(@location(0) uv: vec2): vec4 { const w = array<f32, 3>(0.2, 0.5, 0.3) return vec4(uv, w[2], 1.)}See also
Source
Where the compiler raises this code at commit 26de7be8, one line per file:
-
src/compiler/ts/lower/index-select.ts:54(2 sites)