slint-ui/slint · warning
Unexpected BOOLEAN value type
Error message
Unexpected BOOLEAN value type: ${typeof value} for ${variable.name} What it means
A Figma variable declared as BOOLEAN resolved to a value that is not a boolean nor a resolvable boolean reference. The exporter warns and substitutes the default value for a bool type instead of failing.
Solutions
- Fix the alias in Figma so the BOOLEAN variable references a boolean variable or holds a literal true/false
- Refresh/re-resolve the variables snapshot before exporting
- Trace earlier 'Failed to resolve BOOLEAN reference' warnings to the unresolved alias
- Confirm resolvedType === "BOOLEAN" matches the actual Figma variable type
Example fix
// before
formattedValue = getDefaultValueForType("bool");
// after
if (typeof value !== "boolean") {
throw new Error(`BOOLEAN variable ${variable.name} has non-boolean value: ${JSON.stringify(value)}`);
}
formattedValue = value; Defensive patterns
Strategy: type-guard
Validate before calling
if (variable.resolvedType === "BOOLEAN" && value !== null && typeof value !== "boolean" && typeof (value as any)?.id !== "string") {
throw new Error(`BOOLEAN variable ${variable.name} has invalid value`);
} Type guard
function isBoolValue(v: unknown): boolean {
return typeof v === "boolean" || (typeof v === "object" && v !== null && typeof (v as any).id === "string");
} Try / catch
try {
formattedValue = formatBool(value);
} catch (e) {
exportInfo.errors.add(`BOOLEAN format failed for ${variable.name}: ${e.message}`);
formattedValue = getDefaultValueForType("bool");
} Prevention
- Resolve aliases before formatting boolean values
- Check that aliased targets are of the same type in Figma
- Run a pre-export type validation pass over all variables
When it happens
Trigger: exportFigmaVariablesToSeparateFiles handles a BOOLEAN variable whose value is typeof neither 'boolean' nor an expandable reference object (e.g. alias to a non-boolean variable, null, undefined).
Common situations: Boolean variable aliased to a string/float variable whose resolution failed; stale snapshot after a type change in Figma; API response shape drift.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Unexpected FLOAT value type
- Unexpected STRING value type
- Missing resolved data for
- [getVariablePathString] Collection not found for variable ID
- Mode mismatch for variable
AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16).
Data as JSON: /api/errors/808e76e559a2e710.
Report an issue: GitHub.
Appendix: source
Thrown at tools/figma-inspector/backend/utils/export-variables.ts:1207
if (resolvedValue) {
formattedValue = resolvedValue;
const referenceName =
variableNamesById.get(value.id) ||
value.id;
comment = `Resolved from reference ${referenceName}`;
} else {
formattedValue =
getDefaultValueForType("bool");
const referenceName =
variableNamesById.get(value.id) ||
value.id;
comment = `Failed to resolve reference ${referenceName}, using default`;
exportInfo.warnings.add(
`Failed to resolve BOOLEAN reference ${value.id} for ${variable.name}.${modeName}`,
);
}
} else {
console.warn(
`Unexpected BOOLEAN value type: ${typeof value} for ${variable.name}`,
);
formattedValue = getDefaultValueForType("bool");
}
}
collectionStructure
.get(collectionName)!
.variables.get(sanitizedRowName)!
.set(modeName, {
value: formattedValue,
type: variable.resolvedType,
// No refId - all references are resolved to concrete values
comment: comment,
});
}
// Store the path for each variable IDView on GitHub (pinned to bb937076de)