slint-ui/slint · error

create typescript/generated directory

Error message

create typescript/generated directory

What it means

Error "create typescript/generated directory" thrown in slint-ui/slint.

Source

Thrown at api/node/build.rs:196

            name = entry.name
        ));
    }
    for s in &structs {
        write_jsdoc(&mut ts, "    ", &s.docs);
        ts.push_str(&format!("    export type {name} = {{\n", name = s.name));
        for (field, rust_ty, field_docs, _) in &s.fields {
            write_jsdoc(&mut ts, "        ", field_docs);
            ts.push_str(&format!(
                "        {field}: {ts_ty};\n",
                ts_ty = map_field_type(rust_ty, &in_language),
            ));
        }
        ts.push_str("    };\n");
    }
    ts.push_str("}\n");

    let out_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("typescript").join("generated");
    std::fs::create_dir_all(&out_dir).expect("create typescript/generated directory");
    let out_path = out_dir.join("language.ts");
    // Only write if the content actually changed, so we don't invalidate downstream builds.
    let need_write =
        std::fs::read_to_string(&out_path).map(|existing| existing != ts).unwrap_or(true);
    if need_write {
        std::fs::write(&out_path, ts).expect("write typescript/generated/language.ts");
    }
}

/// Map a Rust field type (as stringified by the macro) to the TS type used in the generated
/// language module. Fails the build with a clear message when a new struct adds an unmapped
/// type — better than silently emitting `unknown`.
fn map_field_type(rust_ty: &str, in_language: &HashSet<&'static str>) -> String {
    let t = rust_ty.trim();
    match t {
        "bool" => "boolean".to_string(),
        "i32" | "f32" | "f64" | "Coord" => "number".to_string(),
        "SharedString" => "string".to_string(),

View on GitHub (pinned to 3fd8f2ec03)

Solutions

  1. Ensure the build script has write permission to create the typescript/generated directory.
  2. Clean stale build artifacts and rebuild.

When it happens

Trigger: Thrown at api/node/build.rs:196 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of slint-ui/slint@3fd8f2ec03 (2026-08-19). Data as JSON: /api/errors/a3f99552c6c77f23. Report an issue: GitHub.