---
title: "TS8069 MISPLACED_DIRECTIVE: TypeShade 컴파일러가 진단에 붙이는 오류 코드"
description: "TS8069 MISPLACED_DIRECTIVE, TypeShade 컴파일러의 오류 코드입니다. \"use typeshade\" 지시문이 다른 최상위 문 뒤에 있습니다(규칙 3.1)."
url: https://typeshade.dev/ko/reference/errors/ts8069/
language: ko
---

# `TS8069`

프런트엔드 코드 `MISPLACED_DIRECTIVE`

`"use typeshade"` 지시문이 다른 최상위 문 뒤에 있습니다([규칙 3.1](https://typeshade.dev/ko/reference/rules/3-1/)). ECMAScript에서 지시문은 맨 앞의 문자열 문일 뿐이어서 TypeScript는 늦게 온 지시문을 평범한 문자열로 읽습니다. 고치는 방법은 지시문을 더하는 것이 아니라 옮기는 것입니다. 지시문이 아예 없는 파일은 `MISSING_DIRECTIVE`입니다.

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

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

## 예제

example.shade.ts

```ts
const width = 640

"use typeshade"

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

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

**TS8069** error, 3행: "use typeshade" must be the file's first statement: here it follows a variable declaration, so TypeScript reads it as an ordinary string and not as a directive. Move it to the top of the file.

## 고치는 법

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

example.shade.ts

```ts
"use typeshade"

const width = 640

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

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

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

A shader file must begin with the directive `"use typeshade"` as its first statement.

## 함께 보기

- [오류 코드](https://typeshade.dev/ko/reference/errors/)

## 소스

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

- [`src/compiler/ts/source-file.ts:779`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/source-file.ts#L779)
