Skip to content

Commit

Permalink
fix: tsify type for HexColor
Browse files Browse the repository at this point in the history
  • Loading branch information
amydevs committed Jul 27, 2024
1 parent 735f30f commit 22b9da8
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ where
}

#[skip_serializing_none]
#[derive(Clone, Copy, Debug, Tsify)]
#[derive(Clone, Copy, Debug)]
pub struct HexColor {
#[tsify(type = "string")]
pub value: Color,
}

Expand Down Expand Up @@ -183,6 +182,18 @@ impl<'de> Deserialize<'de> for HexColor {
}
}

#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(typescript_type = "HexColor")]
pub type HexColorJsType;
}
impl Tsify for HexColor {
type JsType = HexColorJsType;
const DECL: &'static str = "export interface HexColor {\n \"@Value\": string;\n}";
}
#[wasm_bindgen(typescript_custom_section)]
const TS_APPEND_CONTENT: &'static str = "export interface HexColor {\n \"@Value\": string;\n}";

impl Into<HexColor> for RGBAColor {
fn into(self) -> HexColor {
let color: Color = self.into();
Expand Down

0 comments on commit 22b9da8

Please # to comment.