TS8022
Front-end code 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.
The registry text and every compiler message on these pages are the compiler's own English.
Example
"use typeshade"
@fragmentexport function main(@location(0) uv: 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.
"use typeshade"
const gain = 0.5
@fragmentexport function main(@location(0) uv: vec2): vec4 { return vec4(uv, gain, 1.)}The rules this enforces
- Rule 2.1 Test
- Every author-facing name must come from exactly one of three sources:
- Rule 2.2 Test
- A compiler-internal name (§2.1) must not be authorable.
- Rule 8.17 Test
- 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. - Rule 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 - 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 - A call to a function the file neither declares nor imports.
Source
Where the compiler raises this code at commit 26de7be8, one line per file:
-
src/compiler/ts/link.ts:1048 -
src/compiler/ts/lower/class-access.ts:546 -
src/compiler/ts/lower/control.ts:979(2 sites) -
src/compiler/ts/lower/expression-call.ts:309(2 sites) -
src/compiler/ts/lower/expression-prop.ts:189(7 sites) -
src/compiler/ts/lower/expression.ts:426 -
src/compiler/ts/lower/function.ts:535(3 sites) -
src/compiler/ts/lower/local-functions.ts:508 -
src/compiler/ts/lower/new-target.ts:196(2 sites) -
src/compiler/ts/lower/statement.ts:775(5 sites) -
src/compiler/ts/semantic.ts:828 -
src/compiler/ts/source-file.ts:482 -
src/language-service/diagnostics.ts:2191(2 sites)