TS8072
Front-end code IMPORT
An import the compiler does not follow (Rule 3.9, surface §68, proposals 0022 and 0024): a path that names no file or one this compile cannot read, a file that is not a shader module, a package no node_modules holds, a subpath a package's exports does not name, a package's name alone when it has no exports, a # specifier or one that is neither relative nor a package name, a name the module does not export, and the forms a shader module has no use for (a default import or export, an import that names nothing, import(...), require, a module namespace used as a value).
The registry text and every compiler message on these pages are the compiler's own English.
When it fires
An import the compiler does not follow (Rule 3.9, surface §68, proposals 0022 and 0024): a path that names no file or one this compile cannot read, a file that is not a shader module, a package no node_modules holds, a subpath a package's exports does not name, a package's name alone when it has no exports, a # specifier or one that is neither relative nor a package name, a name the module does not export, and the forms a shader module has no use for (a default import or export, an import that names nothing, import(...), require, a module namespace used as a value). Reported on the import, and a use of the name it would have bound reports nothing more (Rule 12.4).
Example
"use typeshade"import { wave } from "./wav.shade.ts"
@fragmentexport function main(@location(0) uv: vec2): vec4 { return vec4(uv, wave(uv), 1.)}Compiled at build time against the pinned compiler, this program gets:
TS8072 error, line 2: Cannot find the shader module "./wav.shade.ts" (looked for "wav.shade.ts").
How to fix it
The same program, corrected. It compiles with no diagnostic.
"use typeshade"import { wave } from "./wave.shade.ts"
@fragmentexport function main(@location(0) uv: vec2): vec4 { return vec4(uv, wave(uv), 1.)}It imports from another file of the same program, which compile() reads through its readDocument option:
"use typeshade"
export function wave(p: vec2): f32 { return sin(p.x * 6.) * cos(p.y * 6.) * 0.5 + 0.5}The rules this enforces
- Rule 3.9 Test
- A shader file may import what another shader file exports, by a relative specifier or, from a package, by the package’s name; the file a compile starts from and every shader file it imports, directly or through another, are one program, which emits one module, and each file keeps the scope TypeScript gives it.
- 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
Source
Where the compiler raises this code at commit 26de7be8, one line per file: