Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: expand rename behaviour when only into / from + implemented with rename_all #51

Open
joshua-auchincloss opened this issue Feb 12, 2024 · 0 comments

Comments

@joshua-auchincloss
Copy link

Noting behaviour where:

  1. The struct has rename_all(deserialize = "...") or rename_all(serialize = "...")
  2. The tsify macro only generates either into_wasm_abi or from_wasm_abi

With the two, if the rename_all aligns with the single generated variant, one would expect the generated TS code to follow the (e.g.) + into_wasm_abi with the rename_all(serialize = "...") outputs. Based on this, hoping to submit this as a FR to add functionality to enable intrinsic renaming behaviour.

Reproducible Issue

use tsify::Tsify;
use serde::Deserialize;

#[derive(Deserialize, Tsify)]
#[tsify(into_wasm_abi)]
#[serde(rename_all(serialize = "camelCase"))
struct MyStruct {
    should_be_camel_in_ts: i32
}

Ts Outputs

interface MyStruct {
   should_be_camel_in_ts: number
}

Expected

interface MyStruct {
   shouldBeCamelInTs: number
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant