TS8022
프런트엔드 코드 UNKNOWN_NAME
Reference to a name TypeShade cannot resolve (identifier, struct field, or struct shape) that is not a function call (UNKNOWN_FN) or a type name (UNKNOWN_TYPE), in a body a call lowers or in one no call lowers; a name the library declares for TypeScript's own use (Object, Math, Symbol), or the file declares as an enum, a namespace, a class or a type, read as a value says what it is.
레지스트리 설명과 컴파일러 메시지는 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.
예제
"use typeshade"
@fragmentexport function main(@location(0) uv: vec2): vec4 { return vec4(uv, gain, 1.)}빌드할 때 고정된 컴파일러로 이 프로그램을 컴파일하면 다음 진단이 나옵니다.
TS8022 error, 5행: Unknown identifier "gain".
고치는 법
같은 프로그램을 고친 모습입니다. 진단 없이 컴파일됩니다.
"use typeshade"
const gain = 0.5
@fragmentexport function main(@location(0) uv: vec2): vec4 { return vec4(uv, gain, 1.)}이 코드가 적용하는 규칙
- 규칙 2.1 테스트
- Every author-facing name must come from exactly one of three sources:
- 규칙 2.2 테스트
- A compiler-internal name (§2.1) must not be authorable.
- 규칙 8.17 테스트
- A local function (a
constthat holds an arrow function or a function expression, or afunctiondeclaration, 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. - 규칙 12.4 테스트
- One mistake reads as one diagnostic; a refusal must not be followed by further diagnostics about the same mistake.
함께 보기
-
SD0006 - component access on a non-vector
-
SD0007 - vector component out of range
-
SD0008 - swizzle on a non-vector
-
TS8002UNKNOWN_TYPE - A type name nothing declares, said once for the file wherever it is written (a parameter, a claim, a type argument,
B<vec3<Foo>>included, an alias, animplementsclause, the base a class or an interface extends, a body no call lowers), a type the library declares for TypeScript alone (Number) where the file declares none of its name, or a type this surface does not take in a position the mapper reads (Rule 2.1). -
TS8004UNKNOWN_FN - 파일이 선언하지도 가져오지도 않은 함수를 부릅니다.
소스
커밋 c66579bf에서 컴파일러가 이 코드를 내는 곳입니다. 파일마다 한 줄씩 적었습니다.
-
src/compiler/ts/link.ts:1048 -
src/compiler/ts/lower/class-access.ts:546 -
src/compiler/ts/lower/control.ts:979(2곳) -
src/compiler/ts/lower/expression-call.ts:316(2곳) -
src/compiler/ts/lower/expression-prop.ts:189(7곳) -
src/compiler/ts/lower/expression.ts:426 -
src/compiler/ts/lower/function.ts:559(3곳) -
src/compiler/ts/lower/local-functions.ts:508 -
src/compiler/ts/lower/new-target.ts:196(2곳) -
src/compiler/ts/lower/statement.ts:775(5곳) -
src/compiler/ts/semantic.ts:808 -
src/compiler/ts/source-file.ts:482 -
src/language-service/diagnostics.ts:2198(2곳)