mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-15 21:02:10 +03:00
fixup! Fix optional arguments in TypeScript
Update tests
This commit is contained in:
parent
d9c559f2ca
commit
608a819c0b
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user