---
title: "TS8022 UNKNOWN_NAME: TypeShade 컴파일러가 진단에 붙이는 오류 코드 한 가지"
description: "TS8022 UNKNOWN_NAME, TypeShade 컴파일러의 오류 코드입니다. TypeShade가 풀지 못하는 이름을 가리킵니다. 함수 호출(UNKNOWN_FN)이나 타입 이름(UNKNOWN_TYPE)은 아닙니다."
url: https://typeshade.dev/ko/reference/errors/ts8022/
language: ko
---

# `TS8022`

프런트엔드 코드 `UNKNOWN_NAME`

TypeShade가 풀지 못하는 이름을 가리킵니다. 함수 호출(`UNKNOWN_FN`)이나 타입 이름(`UNKNOWN_TYPE`)은 아닙니다. 라이브러리가 TypeScript 자체를 위해 선언한 이름(`Object`, `Math`, `Symbol`)이나 파일이 enum, 네임스페이스, 클래스, 타입으로 선언한 이름을 값으로 읽으면, 메시지가 그 이름이 무엇인지 알려 줍니다.

레지스트리에는 이 상수에 대한 문서 주석이 없습니다. 그래서 위 설명은 컴파일러가 이 코드와 함께 내는 메시지를 보고 이 사이트가 쓴 것입니다.

레지스트리 설명과 컴파일러 메시지는 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.

## 예제

example.shade.ts

```ts
"use typeshade"

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

빌드할 때 고정된 컴파일러로 이 프로그램을 컴파일하면 다음 진단이 나옵니다.

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

## 고치는 법

같은 프로그램을 고친 모습입니다. 진단 없이 컴파일됩니다.

example.shade.ts

```ts
"use typeshade"

const gain = 0.5

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

## 이 코드가 적용하는 규칙

**[규칙 2.1](https://typeshade.dev/ko/reference/rules/2-1/) 테스트**

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

**[규칙 2.2](https://typeshade.dev/ko/reference/rules/2-2/) 테스트**

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

**[규칙 8.17](https://typeshade.dev/ko/reference/rules/8-17/) 테스트**

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.

**[규칙 8.19](https://typeshade.dev/ko/reference/rules/8-19/) 테스트**

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/ko/reference/rules/8-17/)), each instance of a generic function ([Rule 8.9](https://typeshade.dev/ko/reference/rules/8-9/)) and of a function that takes a function ([Rule 8.18](https://typeshade.dev/ko/reference/rules/8-18/)), a method, a getter and a field that holds a function ([Rule 8.16](https://typeshade.dev/ko/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.

**[규칙 9.9](https://typeshade.dev/ko/reference/rules/9-9/) 테스트**

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/ko/reference/rules/1-4/)).

**[규칙 12.4](https://typeshade.dev/ko/reference/rules/12-4/) 테스트**

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

## 함께 보기

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

component access on a non-vector

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

vector component out of range

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

swizzle on a non-vector

- [타입](https://typeshade.dev/ko/guide/language/types/)
- [오류 코드](https://typeshade.dev/ko/reference/errors/)

## 소스

커밋 af54ddad5에서 컴파일러가 이 코드를 내는 곳입니다. 파일마다 한 줄씩 적었습니다.

- [`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곳)
- [`src/compiler/ts/lower/expression-call.ts:207`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/expression-call.ts#L207) (3곳)
- [`src/compiler/ts/lower/expression-prop.ts:119`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/expression-prop.ts#L119) (6곳)
- [`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곳)
- [`src/compiler/ts/lower/expression/identifier.ts:73`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/expression/identifier.ts#L73) (2곳)
- [`src/compiler/ts/lower/function.ts:585`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/function.ts#L585) (4곳)
- [`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곳)
- [`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곳)
- [`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곳)
