Skip to content

Commit 620212d

Browse files
paulgbalexcrichton
andcommitted
bool -> boolean in generated TypeScript code (#1933)
* bool -> boolean in generated TypeScript code * Add a test for booleans Co-authored-by: Alex Crichton <[email protected]>
1 parent e169f45 commit 620212d

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

crates/cli-support/src/js/binding.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) ->
875875
}
876876

877877
Instruction::BoolFromI32 => {
878-
js.typescript_required("bool");
878+
js.typescript_required("boolean");
879879
let val = js.pop();
880880
js.push(format!("{} !== 0", val));
881881
}

crates/typescript-tests/src/simple_fn.rs

+3
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ use wasm_bindgen::prelude::*;
22

33
#[wasm_bindgen]
44
pub fn greet(_: &str) {}
5+
6+
#[wasm_bindgen]
7+
pub fn take_and_return_bool(_: bool) -> bool { true }

crates/typescript-tests/src/simple_fn.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ import * as wbg from '../pkg/typescript_tests';
22
import * as wasm from '../pkg/typescript_tests_bg';
33

44
const wbg_greet: (a: string) => void = wbg.greet;
5-
const wasm_greet: (a: number, b: number) => void = wasm.greet;
5+
const wasm_greet: (a: number, b: number) => void = wasm.greet;
6+
const take_and_return_bool: (a: boolean) => boolean = wbg.take_and_return_bool;

0 commit comments

Comments
 (0)