TS8013
On this page

TS8013

Front-end code HOST_STMT

Host control flow and the JavaScript runtime forms no shader has: await, yield, an async or generator function, try/catch/throw, for…in, var, a spread outside an object literal, and a template string.

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

When it fires

Host control flow and the JavaScript runtime forms no shader has: await, yield, an async or generator function, try/catch/throw, for…in, var, a spread outside an object literal, and a template string. A new is a class rule, CLASS_MEMBER.

Example

example.shade.ts
"use typeshade"
@fragment
export function main(@location(0) uv: vec2): vec4 {
try {
return vec4(uv, 0., 1.)
} catch (e) {
return vec4(0., 0., 0., 1.)
}
}

Compiled at build time against the pinned compiler, this program gets:

TS8013 error, line 5: try/catch/throw are JS exceptions. TypeShade has no exception path.

How to fix it

The same program, corrected. It compiles with no diagnostic.

example.shade.ts
"use typeshade"
@fragment
export function main(@location(0) uv: vec2): vec4 {
return vec4(uv, 0., 1.)
}

See also

TS8035 CLASS_MEMBER
A class member shape the surface does not take, or a use of a member the class rules refuse, and a new that builds no class (Rule 8.13).

Source

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

Edit this page Report a problem