{"record":{"id":"808e76e559a2e710","repo":"slint-ui/slint","slug":"unexpected-boolean-value-type-typeof-value-for-variable-name","errorCode":null,"errorMessage":"Unexpected BOOLEAN value type: ${typeof value} for ${variable.name}","messagePattern":"Unexpected BOOLEAN value type: (.+?) for (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"tools/figma-inspector/backend/utils/export-variables.ts","lineNumber":1207,"sourceCode":"                                if (resolvedValue) {\n                                    formattedValue = resolvedValue;\n                                    const referenceName =\n                                        variableNamesById.get(value.id) ||\n                                        value.id;\n                                    comment = `Resolved from reference ${referenceName}`;\n                                } else {\n                                    formattedValue =\n                                        getDefaultValueForType(\"bool\");\n                                    const referenceName =\n                                        variableNamesById.get(value.id) ||\n                                        value.id;\n                                    comment = `Failed to resolve reference ${referenceName}, using default`;\n                                    exportInfo.warnings.add(\n                                        `Failed to resolve BOOLEAN reference ${value.id} for ${variable.name}.${modeName}`,\n                                    );\n                                }\n                            } else {\n                                console.warn(\n                                    `Unexpected BOOLEAN value type: ${typeof value} for ${variable.name}`,\n                                );\n                                formattedValue = getDefaultValueForType(\"bool\");\n                            }\n                        }\n\n                        collectionStructure\n                            .get(collectionName)!\n                            .variables.get(sanitizedRowName)!\n                            .set(modeName, {\n                                value: formattedValue,\n                                type: variable.resolvedType,\n                                // No refId - all references are resolved to concrete values\n                                comment: comment,\n                            });\n                    }\n\n                    // Store the path for each variable ID","sourceCodeStart":1189,"sourceCodeEnd":1225,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/tools/figma-inspector/backend/utils/export-variables.ts#L1189-L1225","documentation":"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.","triggerScenarios":"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).","commonSituations":"Boolean variable aliased to a string/float variable whose resolution failed; stale snapshot after a type change in Figma; API response shape drift.","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"],"exampleFix":"// before\nformattedValue = getDefaultValueForType(\"bool\");\n// after\nif (typeof value !== \"boolean\") {\n  throw new Error(`BOOLEAN variable ${variable.name} has non-boolean value: ${JSON.stringify(value)}`);\n}\nformattedValue = value;","handlingStrategy":"type-guard","validationCode":"if (variable.resolvedType === \"BOOLEAN\" && value !== null && typeof value !== \"boolean\" && typeof (value as any)?.id !== \"string\") {\n  throw new Error(`BOOLEAN variable ${variable.name} has invalid value`);\n}","typeGuard":"function isBoolValue(v: unknown): boolean {\n  return typeof v === \"boolean\" || (typeof v === \"object\" && v !== null && typeof (v as any).id === \"string\");\n}","tryCatchPattern":"try {\n  formattedValue = formatBool(value);\n} catch (e) {\n  exportInfo.errors.add(`BOOLEAN format failed for ${variable.name}: ${e.message}`);\n  formattedValue = getDefaultValueForType(\"bool\");\n}","preventionTips":["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"],"tags":["figma","variables","type-mismatch","export"],"backgroundTag":"type-mismatch","analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}