fixup! Fix optional arguments in TypeScript

Update tests
This commit is contained in:
Danilo Bargen 2019-05-09 18:36:47 +02:00
parent d9c559f2ca
commit 608a819c0b
2 changed files with 11 additions and 2 deletions
crates/typescript-tests/src

View File

@ -1,6 +1,14 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn opt_fn(_a: Option<i32>) -> Option<i32> {
/// Optional parameters followed by non-optional parameters.
/// Only the parameter _c may be marked as omittable.
pub fn opt_fn_mixed(_a: Option<i32>, _b: i32, _c: Option<i32>) -> Option<i32> {
None
}
#[wasm_bindgen]
/// Only optional parameters. All of them may be marked as omittable.
pub fn opt_fn_only(_a: Option<i32>, _b: Option<i32>, _c: Option<i32>) -> Option<i32> {
None
}

View File

@ -1,3 +1,4 @@
import * as wbg from '../pkg/typescript_tests';
const opt_fn: (a?: number) => number | undefined = wbg.opt_fn;
const opt_fn_mixed: (a: number | undefined, b: number, c?: number) => number | undefined = wbg.opt_fn_mixed;
const opt_fn_only: (a?: number, b?: number, c?: number) => number | undefined = wbg.opt_fn_only;