mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-16 22:41:24 +00:00
Reflect optional struct fields in typescript (#1990)
* reflect option struct fields in typescript * optional fields: move type checker to getter * infer optional fields from ts_args
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
pub mod custom_section;
|
||||
pub mod getters_setters;
|
||||
pub mod opt_args_and_ret;
|
||||
pub mod optional_fields;
|
||||
pub mod simple_fn;
|
||||
pub mod simple_struct;
|
||||
|
7
crates/typescript-tests/src/optional_fields.rs
Normal file
7
crates/typescript-tests/src/optional_fields.rs
Normal file
@ -0,0 +1,7 @@
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub struct Fields {
|
||||
pub hallo: Option<bool>,
|
||||
pub spaceboy: bool,
|
||||
}
|
3
crates/typescript-tests/src/optional_fields.ts
Normal file
3
crates/typescript-tests/src/optional_fields.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import * as wbg from '../pkg/typescript_tests';
|
||||
|
||||
const fields: wbg.Fields = { spaceboy: true, free: () => { } };
|
Reference in New Issue
Block a user