fix(napi-derive-backend): do not unwrap Option value in object getter if the type of field is Option<T>
This commit is contained in:
parent
d58e488fa2
commit
6d4b4af36f
7 changed files with 55 additions and 4 deletions
crates/napi/src/bindgen_runtime/js_values
|
@ -35,7 +35,7 @@ impl Object {
|
|||
|
||||
let ty = type_of!(self.0.env, ret)?;
|
||||
|
||||
Ok(if ty == ValueType::Undefined {
|
||||
Ok(if ty == ValueType::Undefined || ty == ValueType::Null {
|
||||
None
|
||||
} else {
|
||||
Some(V::from_napi_value(self.0.env, ret)?)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue