---
title: "TS8022 UNKNOWN_NAME: an error code of the TypeShade compiler"
description: "TS8022 UNKNOWN_NAME, an error code of the TypeShade compiler. A reference to a name that TypeShade cannot resolve and that is not a function call (UNKNOWN_FN)…"
url: https://typeshade.dev/reference/errors/ts8022/
language: en
---

# `TS8022`

Front-end code `UNKNOWN_NAME`

A reference to a name that TypeShade cannot resolve and that is not a function call (`UNKNOWN_FN`) or a type name (`UNKNOWN_TYPE`). A name that the library declares for TypeScript's own use (`Object`, `Math`, `Symbol`), or that the file declares as an enum, a namespace, a class or a type, and that is read as a value, says what it is.

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"

@fragment
export function main(uv: location<0, vec2>): vec4 {
  return vec4(uv, gain, 1.)
}
```

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

**TS8022** error, line 5: Unknown identifier "gain".

## How to fix it

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

example.shade.ts

```ts
"use typeshade"

const gain = 0.5

@fragment
export function main(uv: location<0, vec2>): vec4 {
  return vec4(uv, gain, 1.)
}
```

## The rules this enforces

**[Rule 2.1](https://typeshade.dev/reference/rules/2-1/) Test**

Every author-facing name must come from exactly one of three sources:

**[Rule 2.2](https://typeshade.dev/reference/rules/2-2/) Test**

A compiler-internal name (§2.1) must not be authorable.

**[Rule 8.17](https://typeshade.dev/reference/rules/8-17/) Test**

A local function (a `const` that holds an arrow function or a function expression, or a `function` declaration, written inside a function’s body) is a function of the module named after the body that declares it (surface §14), and it may read and write the variables of the functions around it, as a TypeScript closure does.

**[Rule 8.19](https://typeshade.dev/reference/rules/8-19/) Test**

A function that writes no return type returns what its body does, as TypeScript infers it: a function of the file or of a namespace, a local function ([Rule 8.17](https://typeshade.dev/reference/rules/8-17/)), each instance of a generic function ([Rule 8.9](https://typeshade.dev/reference/rules/8-9/)) and of a function that takes a function ([Rule 8.18](https://typeshade.dev/reference/rules/8-18/)), a method, a getter and a field that holds a function ([Rule 8.16](https://typeshade.dev/reference/rules/8-16/)) take the type of their first `return` with a value, the `return`s after it are typed against that type as against a written one, and one with no such `return` returns nothing.

**[Rule 9.9](https://typeshade.dev/reference/rules/9-9/) Test**

A WGSL built-in function, an overload of one, or a §9.3 name must not be authorable when an ECMAScript spelling the compiler supports carries every case it accepts with the same meaning ([Rule 1.4](https://typeshade.dev/reference/rules/1-4/)).

**[Rule 12.4](https://typeshade.dev/reference/rules/12-4/) Test**

One mistake reads as one diagnostic; a refusal must not be followed by further diagnostics about the same mistake.

## See also

**[`SD0006`](https://typeshade.dev/reference/errors/sd0006/)**

component access on a non-vector

**[`SD0007`](https://typeshade.dev/reference/errors/sd0007/)**

vector component out of range

**[`SD0008`](https://typeshade.dev/reference/errors/sd0008/)**

swizzle on a non-vector

- [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/link.ts:828`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/link.ts#L828)
- [`src/compiler/ts/lower/class-access/super-access.ts:92`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/class-access/super-access.ts#L92)
- [`src/compiler/ts/lower/control/for-update.ts:74`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/control/for-update.ts#L74) (2 sites)
- [`src/compiler/ts/lower/expression-call.ts:207`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/expression-call.ts#L207) (3 sites)
- [`src/compiler/ts/lower/expression-prop.ts:119`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/expression-prop.ts#L119) (6 sites)
- [`src/compiler/ts/lower/expression-prop/object-literal.ts:85`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/expression-prop/object-literal.ts#L85) (2 sites)
- [`src/compiler/ts/lower/expression/identifier.ts:73`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/expression/identifier.ts#L73) (2 sites)
- [`src/compiler/ts/lower/function.ts:585`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/function.ts#L585) (4 sites)
- [`src/compiler/ts/lower/local-functions/captures.ts:248`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/local-functions/captures.ts#L248)
- [`src/compiler/ts/lower/new-target.ts:117`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/new-target.ts#L117) (3 sites)
- [`src/compiler/ts/lower/statement.ts:369`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/statement.ts#L369)
- [`src/compiler/ts/lower/statement/binding-pattern.ts:311`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/statement/binding-pattern.ts#L311) (2 sites)
- [`src/compiler/ts/lower/statement/declaration-forms.ts:57`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/statement/declaration-forms.ts#L57)
- [`src/compiler/ts/lower/statement/lvalue.ts:116`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/statement/lvalue.ts#L116)
- [`src/compiler/ts/lower/statement/writable.ts:92`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/statement/writable.ts#L92)
- [`src/compiler/ts/math-binding.ts:185`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/math-binding.ts#L185)
- [`src/compiler/ts/semantic.ts:616`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/semantic.ts#L616)
- [`src/compiler/ts/source-file.ts:478`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/source-file.ts#L478)
- [`src/language-service/diagnostics/refused-uses.ts:226`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/diagnostics/refused-uses.ts#L226) (2 sites)
