TS8023
On this page

TS8023

Front-end code DUPLICATE_SYMBOL

The same function, binding, module constant or struct name declared twice in one scope.

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

When it fires

The same function, binding, module constant or struct name declared twice in one scope. A struct counts whichever of the three spellings each declaration used: a class, an interface and a type alias of one name are one struct, not declarations that merge.

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(@location(0) uv: 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(@location(0) uv: 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 26de7be8, one line per file:

Edit this page Report a problem