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:
clearloop
2020-02-18 23:15:37 +08:00
committed by GitHub
parent 156e1cb47f
commit b6190700c9
6 changed files with 59 additions and 16 deletions

View File

@ -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;

View File

@ -0,0 +1,7 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub struct Fields {
pub hallo: Option<bool>,
pub spaceboy: bool,
}

View File

@ -0,0 +1,3 @@
import * as wbg from '../pkg/typescript_tests';
const fields: wbg.Fields = { spaceboy: true, free: () => { } };