mirror of
https://github.com/xazukx/ts-rs.git
synced 2026-08-23 12:58:33 +00:00
Make rename_all compatible with tuple and unit structs as a no-op attribute (#422)
This commit is contained in:
@@ -132,10 +132,6 @@ impl Attr for StructAttr {
|
||||
if self.tag.is_some() {
|
||||
syn_err!("`tag` cannot be used with unit or tuple structs");
|
||||
}
|
||||
|
||||
if self.rename_all.is_some() {
|
||||
syn_err!("`rename_all` cannot be used with unit or tuple structs");
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -24,7 +24,7 @@ fn test_newtype() {
|
||||
}
|
||||
|
||||
#[derive(TS)]
|
||||
#[ts(export, export_to = "tuple/")]
|
||||
#[ts(export, export_to = "tuple/", rename_all = "camelCase")] // rename_all should compile, but it's a noop
|
||||
struct TupleNewType(String, i32, (i32, i32));
|
||||
|
||||
#[test]
|
||||
@@ -36,7 +36,7 @@ fn test_tuple_newtype() {
|
||||
}
|
||||
|
||||
#[derive(TS)]
|
||||
#[ts(export, export_to = "tuple/")]
|
||||
#[ts(export, export_to = "tuple/", rename_all = "kebab-case")]
|
||||
struct Dep1;
|
||||
|
||||
#[derive(TS)]
|
||||
|
||||
Reference in New Issue
Block a user