{"record":{"id":"2d26f1d64a2c5083","repo":"slint-ui/slint","slug":"unexpected-string-value-type-typeof-value-for-variable-name","errorCode":null,"errorMessage":"Unexpected STRING value type: ${typeof value} for ${variable.name}","messagePattern":"Unexpected STRING value type: (.+?) for (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"tools/figma-inspector/backend/utils/export-variables.ts","lineNumber":1168,"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(\"string\");\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 STRING reference ${value.id} for ${variable.name}.${modeName}`,\n                                    );\n                                }\n                            } else {\n                                console.warn(\n                                    `Unexpected STRING value type: ${typeof value} for ${variable.name}`,\n                                );\n                                formattedValue =\n                                    getDefaultValueForType(\"string\");\n                            }\n                        } else if (variable.resolvedType === \"BOOLEAN\") {\n                            if (typeof value === \"boolean\") {\n                                formattedValue = value ? \"true\" : \"false\";\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":1150,"sourceCodeEnd":1186,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/tools/figma-inspector/backend/utils/export-variables.ts#L1150-L1186","documentation":"A Figma variable declared as STRING resolved to a value that is not a string nor a resolvable string reference. The exporter warns and substitutes the default value for a string type instead of failing.","triggerScenarios":"exportFigmaVariablesToSeparateFiles handles a STRING variable whose value is typeof neither 'string' nor an expandable reference object (e.g. alias to a non-string variable, null, undefined).","commonSituations":"String variable aliased to a color/float variable whose resolution failed; Figma API shape change; stale cached resolved data after the variable type changed in Figma.","solutions":["Fix the alias in Figma so the STRING variable references a string variable or holds a literal string","Refresh/re-resolve the variables snapshot so references are expanded before formatting","Trace earlier 'Failed to resolve STRING reference' warnings to the unresolved alias","Validate variable.resolvedType classification against the actual Figma type"],"exampleFix":"// before\nformattedValue = getDefaultValueForType(\"string\");\n// after\nif (typeof value !== \"string\") {\n  exportInfo.errors.add(`STRING variable ${variable.name} has non-string value`);\n  formattedValue = \"\"; // or throw, depending on strictness\n}","handlingStrategy":"type-guard","validationCode":"if (variable.resolvedType === \"STRING\" && value !== null && typeof value !== \"string\" && typeof (value as any)?.id !== \"string\") {\n  throw new Error(`STRING variable ${variable.name} has invalid value`);\n}","typeGuard":"function isStringValue(v: unknown): boolean {\n  return typeof v === \"string\" || (typeof v === \"object\" && v !== null && typeof (v as any).id === \"string\");\n}","tryCatchPattern":"try {\n  formattedValue = formatString(value);\n} catch (e) {\n  exportInfo.errors.add(`STRING format failed for ${variable.name}: ${e.message}`);\n  formattedValue = getDefaultValueForType(\"string\");\n}","preventionTips":["Resolve aliases before formatting string values","Validate value types against resolvedType in a pre-export pass","Refresh the snapshot whenever variable types change in Figma"],"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"}