TS8069
이 페이지에서

TS8069

프런트엔드 코드 MISPLACED_DIRECTIVE

A "use typeshade" directive after another top-level statement (Rule 3.1).

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

발생 조건

A "use typeshade" directive after another top-level statement (Rule 3.1). In ECMAScript a directive is only a leading string-literal statement, so TypeScript reads a late one as an ordinary string while TypeShade reads the file as a shader. Reported on the directive, and the rest of the file is still checked. Kept apart from MISSING_DIRECTIVE, which means that there is no directive, because the fix is different: move it, don't add one (proposal 0012).

예제

example.shade.ts
const width = 640
"use typeshade"
@fragment
export function main(@location(0) uv: 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
"use typeshade"
const width = 640
@fragment
export function main(@location(0) uv: vec2): vec4 {
return vec4(uv, 0., 1.)
}

이 코드가 적용하는 규칙

규칙 3.1 테스트
A shader file must begin with the directive "use typeshade" as its first statement.

함께 보기

TS8001 MISSING_DIRECTIVE
TypeShade로 컴파일하는 파일에 "use typeshade" 지시문이 아예 없습니다.

소스

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

이 페이지 편집 문제 보고