TS8014
On this page

TS8014

Front-end code TOP_LEVEL

Something at the top level of the file the compiler cannot declare: a bare statement, or a module-level declaration of a shape it refuses.

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

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

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

TS8014 error, line 4: Top-level expressions are not a TypeShade program. Put work inside a function.

How to fix it

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

example.shade.ts
"use typeshade"
class Uniforms {
frame: f32
}
declare const u: uniform<Uniforms>
@fragment
export function main(@location(0) uv: vec2): vec4 {
return vec4(uv, fract(u.frame / 60.), 1.)
}

See also

SD0014
override (specialization constant) must be a WGSL scalar type

Source

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

Edit this page Report a problem