Skip to content

Type name collision / re-enable renaming #16

@Pistonight

Description

@Pistonight

Previously #[serde(rename = "...")] can be used to rename types, but it had a problem when the type is referenced in other types madonoharu#43

However, without renaming, there could be name collisions

use serde::{Deserialize, Serialize};
use tsify::Tsify;
use wasm_bindgen::prelude::*;

mod foo {
  #[derive(Tsify, Serialize, Deserialize)]
  #[tsify(into_wasm_abi, from_wasm_abi)]
  pub struct Bar {
     ...
  }
}
mod biz {
  #[derive(Tsify, Serialize, Deserialize)]
  #[tsify(into_wasm_abi, from_wasm_abi)]
  pub struct Bar {
    ...
  }
}

becomes

export interface Bar {
  ...
}
export interface Bar {
  ...
}

To fix this, 3e81856 could be reverted to enable rename again, and madonoharu#43 can be addressed with #[tsify(type = "RenamedType")]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions