chore(napi): misc cleanup

This commit is contained in:
LongYinan 2022-08-23 16:17:53 +08:00
parent 03e80361d9
commit 36275438ad
No known key found for this signature in database
GPG key ID: C3666B7FC82ADAD7
2 changed files with 7 additions and 1 deletions

View file

@ -724,6 +724,12 @@ impl ParseNapi for syn::ItemFn {
"#[napi] can't be applied to a function with #[napi(ts_type)]"
);
}
if opts.return_if_invalid().is_some() && opts.strict().is_some() {
bail_span!(
self,
"#[napi(return_if_invalid)] can't be used with #[napi(strict)]"
);
}
let napi = self.convert_to_ast(opts);
self.to_tokens(tokens);

View file

@ -30,7 +30,7 @@ impl Object {
check_status!(
sys::napi_get_named_property(self.0.env, self.0.value, c_field.as_ptr(), &mut ret),
"Failed to get property with field `{}`",
c_field.to_string_lossy(),
field.as_ref(),
)?;
let ty = type_of!(self.0.env, ret)?;