{"record":{"id":"1f9dd92c3e003faa","repo":"slint-ui/slint","slug":"unmapped-struct-field-type-other-for-default-value","errorCode":null,"errorMessage":"Unmapped struct field type `{other}` for default-value computation. Extend `field_default` in api/node/build.rs.","messagePattern":"Unmapped struct field type `(.+?)` for default-value computation\\. Extend `field_default` in api/node/build\\.rs\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/node/build.rs","lineNumber":249,"sourceCode":"        return match text.split_once(\"::\") {\n            // Enum values are kebab-case strings in the JS API\n            Some((_, variant)) => {\n                format!(\"\\\"{}\\\"\", to_kebab_case(variant.trim_start_matches(\"r#\")))\n            }\n            // bool and number literals are the same in JS\n            None => text,\n        };\n    }\n    let t = rust_ty.trim();\n    match t {\n        \"bool\" => \"false\".to_string(),\n        \"i32\" | \"f32\" | \"f64\" | \"Coord\" => \"0\".to_string(),\n        \"SharedString\" => \"\\\"\\\"\".to_string(),\n        \"DataTransfer\" => \"new DataTransfer()\".to_string(),\n        \"LogicalPosition\" => \"{ x: 0, y: 0 }\".to_string(),\n        ident if enum_defaults.contains_key(ident) => format!(\"\\\"{}\\\"\", enum_defaults[ident]),\n        ident if structs.contains(ident) => format!(\"_data.{ident}()\"),\n        other => panic!(\n            \"Unmapped struct field type `{other}` for default-value computation. \\\n             Extend `field_default` in api/node/build.rs.\"\n        ),\n    }\n}\n\n/// Emit a `Foo: (props?: Partial<language.Foo>): language.Foo => Object.freeze({ … })` factory\n/// inside `_data`. The factory exists so consumers can build values without specifying every\n/// field, which gives us forward-compatibility (the Rust-side analogue of `#[non_exhaustive]`).\nfn emit_struct_factory(\n    out: &mut String,\n    s: &StructEntry,\n    enum_defaults: &HashMap<&'static str, String>,\n    struct_names: &HashSet<&'static str>,\n) {\n    out.push_str(\"    /**\\n\");\n    out.push_str(\n        \"     * Build a value of this struct. Any field you omit takes a documented default,\\n\",","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/api/node/build.rs#L231-L267","documentation":"field_default computes a JS default-value literal for each builtin struct field type. This panic is the same style of forward-compatibility guard as map_field_type: a struct field whose Rust type has no arm in the match cannot get a default expression, so the build stops with instructions to extend field_default. The offending input is the unmapped Rust type string; without the guard the generated code would have a missing or wrong initializer.","triggerScenarios":"Thrown at api/node/build.rs:249 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a match arm in field_default in api/node/build.rs returning a correct JS default-expression for the new type","For a type that needs a non-trivial default, emit a constructor call or 'undefined' intentionally after confirming the JS runtime accepts it","If the field must not appear in defaults, exclude it in the struct-walking code rather than extending the match"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}