{"record":{"id":"ea55ab315f2decfb","repo":"slint-ui/slint","slug":"unexpected-float-value-type-typeof-value-for-variable-name","errorCode":null,"errorMessage":"Unexpected FLOAT value type: ${typeof value} for ${variable.name}","messagePattern":"Unexpected FLOAT value type: (.+?) for (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"tools/figma-inspector/backend/utils/export-variables.ts","lineNumber":1129,"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(\"length\");\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 FLOAT reference ${value.id} for ${variable.name}.${modeName}`,\n                                    );\n                                }\n                            } else {\n                                console.warn(\n                                    `Unexpected FLOAT value type: ${typeof value} for ${variable.name}`,\n                                );\n                                formattedValue =\n                                    getDefaultValueForType(\"length\");\n                            }\n                        } else if (variable.resolvedType === \"STRING\") {\n                            if (typeof value === \"string\") {\n                                formattedValue = `\"${value}\"`;\n                            } else if (\n                                typeof value === \"object\" &&\n                                value &&\n                                \"type\" in value &&\n                                value.type === \"VARIABLE_ALIAS\"\n                            ) {\n                                // Resolve reference to concrete value immediately\n                                const resolvedValue =\n                                    await followChainToConcreteValue(\n                                        value.id,","sourceCodeStart":1111,"sourceCodeEnd":1147,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/tools/figma-inspector/backend/utils/export-variables.ts#L1111-L1147","documentation":"A Figma variable declared as FLOAT (numeric) resolved to a value whose runtime type is neither a number nor a resolvable reference. The exporter warns, and falls back to the default value for a length type (getDefaultValueForType(\"length\")) instead of failing the export.","triggerScenarios":"exportFigmaVariablesToSeparateFiles handles a FLOAT variable whose value is typeof neither 'number' nor a resolvable variable reference object (e.g. an alias that failed resolution earlier, or null/undefined).","commonSituations":"A FLOAT variable is aliased to a variable of another type whose resolution failed upstream; the Figma API returned an unexpected shape; the variable type was changed in Figma without re-resolving cached data.","solutions":["Fix the variable's alias in Figma so it points at a FLOAT variable (or set a raw numeric value)","Re-resolve references/refresh the snapshot so value references are expanded before formatting","Check earlier 'Failed to resolve FLOAT reference' warnings to find the root unresolved alias","Loosen/verify the variable.resolvedType === \"FLOAT\" classification if the data is actually another type"],"exampleFix":"// before\nconsole.warn(`Unexpected FLOAT value type: ${typeof value} ...`);\nformattedValue = getDefaultValueForType(\"length\");\n// after\nif (typeof value !== \"number\") {\n  throw new Error(`FLOAT variable ${variable.name} has non-numeric value: ${JSON.stringify(value)}`);\n}\nformattedValue = formatNumber(value);","handlingStrategy":"type-guard","validationCode":"if (variable.resolvedType === \"FLOAT\" && value !== null && typeof value !== \"number\" && typeof (value as any)?.id !== \"string\") {\n  throw new Error(`FLOAT variable ${variable.name} has invalid value`);\n}","typeGuard":"function isFloatValue(v: unknown): boolean {\n  return typeof v === \"number\" || (typeof v === \"object\" && v !== null && typeof (v as any).id === \"string\");\n}","tryCatchPattern":"try {\n  formattedValue = formatFloat(value);\n} catch (e) {\n  exportInfo.errors.add(`FLOAT format failed for ${variable.name}: ${e.message}`);\n  formattedValue = getDefaultValueForType(\"length\");\n}","preventionTips":["Resolve all aliases before type-dispatching on the value","Keep resolvedType in sync with the actual Figma variable type","Add a pre-export validation pass that checks value types per resolvedType"],"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"}