---
title: "TS8023 DUPLICATE_SYMBOL: a TypeShade compiler error code"
description: "TS8023 DUPLICATE_SYMBOL, an error code of the TypeShade compiler. The same function, binding, module constant or struct name declared twice in one scope."
url: https://typeshade.dev/reference/errors/ts8023/
language: en
---

# `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

```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

```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](https://typeshade.dev/reference/rules/4-2/) Test**

A type alias is another name for its target.

## See also

- [Types](https://typeshade.dev/guide/language/types/)
- [Error codes](https://typeshade.dev/reference/errors/)

## Source

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

- [`src/compiler/ts/bindings.ts:115`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/bindings.ts#L115)
- [`src/compiler/ts/link.ts:814`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/link.ts#L814)
- [`src/compiler/ts/lower/control/for-of.ts:128`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/control/for-of.ts#L128)
- [`src/compiler/ts/lower/function.ts:357`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/function.ts#L357) (4 sites)
- [`src/compiler/ts/lower/second-name.ts:153`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/second-name.ts#L153)
- [`src/compiler/ts/lower/statement/declaration-kind.ts:94`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/statement/declaration-kind.ts#L94) (2 sites)
- [`src/compiler/ts/lower/statement/define-local.ts:47`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/statement/define-local.ts#L47)
- [`src/compiler/ts/module-const.ts:204`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/module-const.ts#L204) (2 sites)
- [`src/compiler/ts/module-vars.ts:215`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/module-vars.ts#L215) (2 sites)
- [`src/compiler/ts/source-file.ts:825`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/source-file.ts#L825)
- [`src/compiler/ts/structs/add-struct.ts:73`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/structs/add-struct.ts#L73)
- [`src/compiler/ts/structs/candidates.ts:67`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/structs/candidates.ts#L67)
