diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 8a150de5816..9be761ac818 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3794,7 +3794,11 @@ __wbg_set_wasm(wasm);" if enum_.generate_typescript { self.typescript.push('\n'); if !variant_docs.is_empty() { - self.typescript.push_str(&variant_docs); + for line in variant_docs.lines() { + self.typescript.push_str(" "); + self.typescript.push_str(line); + self.typescript.push('\n'); + } } self.typescript.push_str(&format!(" {name} = {value},")); } diff --git a/crates/cli/tests/reference/enums.d.ts b/crates/cli/tests/reference/enums.d.ts index e6c6229b926..42169b11fd1 100644 --- a/crates/cli/tests/reference/enums.d.ts +++ b/crates/cli/tests/reference/enums.d.ts @@ -24,8 +24,17 @@ export function option_string_enum_echo(color?: ColorName): ColorName | undefine * A color. */ export enum Color { + /** + * Green as a leaf. + */ Green = 0, + /** + * Yellow as the sun. + */ Yellow = 1, + /** + * Red as a rose. + */ Red = 2, } /** diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js index a2ef36d4aaf..22e4110c15e 100644 --- a/crates/cli/tests/reference/enums.js +++ b/crates/cli/tests/reference/enums.js @@ -65,7 +65,19 @@ export function option_string_enum_echo(color) { /** * A color. */ -export const Color = Object.freeze({ Green:0,"0":"Green",Yellow:1,"1":"Yellow",Red:2,"2":"Red", }); +export const Color = Object.freeze({ +/** + * Green as a leaf. + */ +Green:0,"0":"Green", +/** + * Yellow as the sun. + */ +Yellow:1,"1":"Yellow", +/** + * Red as a rose. + */ +Red:2,"2":"Red", }); const __wbindgen_enum_ColorName = ["green", "yellow", "red"]; diff --git a/crates/cli/tests/reference/enums.rs b/crates/cli/tests/reference/enums.rs index 7e588df0f4d..a7e5f0b0ca8 100644 --- a/crates/cli/tests/reference/enums.rs +++ b/crates/cli/tests/reference/enums.rs @@ -4,8 +4,11 @@ use wasm_bindgen::prelude::*; #[wasm_bindgen] #[derive(PartialEq, Debug)] pub enum Color { + /// Green as a leaf. Green, + /// Yellow as the sun. Yellow, + /// Red as a rose. Red, }