slint-ui/slint · warning

Warning

Error message

Warning: ${w}

What it means

This is Node.js console.warn output in the Node/TypeScript API's `loadSlint` (used by loadFile and loadSource): when compiling a .slint document produces diagnostics of level Warning and `options.quiet !== true`, each warning is printed as "Warning: " + diagnostic. It is informational output, not an exception; compilation may still have succeeded unless errors are also present.

Solutions

  1. Fix the .slint source issues the warnings point to
  2. Pass `{ quiet: true }` in the loadSlint options to suppress console output
  3. Handle diagnostics programmatically instead of relying on console output
  4. Update deprecated constructs flagged by the newer compiler version

Example fix

// before
await slint.loadSlint(sourcePath);
// after
await slint.loadSlint(sourcePath, { quiet: true });
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check the .slint source with the compiler API or LSP for warnings
// before loadSlint, or review diagnostics returned by the loader.

Type guard

function hasWarnings(diagnostics: napi.Diagnostic[]): napi.Diagnostic[] {
    return diagnostics.filter((d) => d.level === napi.DiagnosticLevel.Warning);
}

Try / catch

try {
    await slint.loadSlint(path, { quiet: true });
} catch (e) {
    console.error("Failed to load slint file:", e);
}

Prevention

When it happens

Trigger: Calling loadFile/loadSource (without `{ quiet: true }`) on a .slint file whose compilation emits warnings — e.g. deprecated syntax, unused elements, or suspicious constructs recognized by the Slint compiler.

Common situations: Loading legacy .slint files after a Slint version upgrade, files using deprecated properties or syntax, or CI logs cluttered with compiler warnings.

Understand the failure class

Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.

Related errors


AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16). Data as JSON: /api/errors/9db479c24580bcaf. Report an issue: GitHub.

Appendix: source

Thrown at api/node/typescript/index.ts:333

        }
        if (typeof options.fileLoader !== "undefined") {
            compiler.fileLoader = options.fileLoader;
        }
    }

    const definitions =
        loadData.from === "file"
            ? compiler.buildFromPath(filePath)
            : compiler.buildFromSource(loadData.fileData.source, filePath);
    const diagnostics = compiler.diagnostics;

    if (diagnostics.length > 0) {
        const warnings = diagnostics.filter(
            (d) => d.level === napi.DiagnosticLevel.Warning,
        );

        if (typeof options !== "undefined" && options.quiet !== true) {
            warnings.forEach((w) => console.warn("Warning: " + w));
        }

        const errors = diagnostics.filter(
            (d) => d.level === napi.DiagnosticLevel.Error,
        );

        if (errors.length > 0) {
            throw new CompileError("Could not compile " + filePath, errors);
        }
    }

    const slint_module = Object.create({});

    // generate structs
    const structs = compiler.structs;

    for (const key in compiler.structs) {
        Object.defineProperty(slint_module, translateName(key), {

View on GitHub (pinned to bb937076de)