TS8023
On this page

TS8023

Front-end code DUPLICATE_SYMBOL

The same function, binding, module constant or struct name declared twice in one scope. A struct counts whichever spelling each declaration uses: a class, an interface and a type alias of one name are one struct, so a second declaration is a duplicate.

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"
function shade(x: f32): f32 {
return x * 0.5
}
function shade(x: f32): f32 {
return x * 0.25
}
@fragment
export function main(uv: location<0, vec2>): vec4 {
return vec4(uv, shade(uv.x), 1.)
}

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

TS8023 error, line 7: Duplicate function "shade".

How to fix it

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

example.shade.ts
"use typeshade"
function shade(x: f32): f32 {
return x * 0.5
}
function shadeQuarter(x: f32): f32 {
return x * 0.25
}
@fragment
export function main(uv: location<0, vec2>): vec4 {
return vec4(uv, shade(uv.x) + shadeQuarter(uv.y), 1.)
}

The rule this enforces

Rule 4.2 Test
A type alias is another name for its target.

See also

Source

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

Edit this page Report a problem