{"record":{"id":"e8a9617e875fde21","repo":"slint-ui/slint","slug":"expect-string-got-vt","errorCode":null,"errorMessage":"expect String, got: {vt:?}","messagePattern":"expect String, got: (.+?)","errorType":"exception","errorClass":"napi::Error","httpStatus":null,"severity":"error","filePath":"api/node/rust/interpreter/value.rs","lineNumber":44,"sourceCode":"    }\n}\n\n/// Safely extract a f64 from an Unknown, failing if the type is wrong.\nfn expect_number(unknown: Unknown<'_>) -> Result<f64> {\n    match unknown.get_type()? {\n        ValueType::Number => unknown.coerce_to_number()?.get_double(),\n        vt => Err(napi::Error::new(\n            napi::Status::NumberExpected,\n            format!(\"expect Number, got: {vt:?}\"),\n        )),\n    }\n}\n\n/// Safely extract a String from an Unknown, failing if the type is wrong.\nfn expect_string(unknown: Unknown<'_>) -> Result<String> {\n    match unknown.get_type()? {\n        ValueType::String => Ok(unknown.coerce_to_string()?.into_utf8()?.as_str()?.to_owned()),\n        vt => Err(napi::Error::new(\n            napi::Status::StringExpected,\n            format!(\"expect String, got: {vt:?}\"),\n        )),\n    }\n}\n\n/// Safely extract a bool from an Unknown, failing if the type is wrong.\nfn expect_bool(unknown: Unknown<'_>) -> Result<bool> {\n    match unknown.get_type()? {\n        ValueType::Boolean => Ok(unknown.coerce_to_bool()?),\n        vt => Err(napi::Error::new(\n            napi::Status::BooleanExpected,\n            format!(\"expect Boolean, got: {vt:?}\"),\n        )),\n    }\n}\n\n#[napi(js_name = \"ValueType\")]","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/slint-ui/slint/blob/3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016/api/node/rust/interpreter/value.rs#L26-L62","documentation":"Error \"expect String, got: {vt:?}\" thrown in slint-ui/slint.","triggerScenarios":"Thrown at api/node/rust/interpreter/value.rs:44 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a JavaScript string where the Slint value expects a String.","Convert the value with String() before passing it."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016","analyzedAt":"2026-08-19T23:23:16.610Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}