Skip to content

Commit

Permalink
closes #148
Browse files Browse the repository at this point in the history
  • Loading branch information
oscartbeaumont committed Sep 21, 2023
1 parent 14a2aa6 commit c23c184
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions macros/src/type/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ pub fn construct_datatype(
)#transform;
});
}
Type::Paren(p) => {
return construct_datatype(var_ident, &p.elem, generic_idents, crate_ref, inline)
}
Type::Array(TypeArray { elem, .. }) | Type::Slice(TypeSlice { elem, .. }) => {
let elem_var_ident = format_ident!("{}_el", &var_ident);
let elem = construct_datatype(
Expand Down
17 changes: 16 additions & 1 deletion tests/ts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ fn typescript_types() {
assert_ts!((String,), r#"[string]"#);
}

// https://github.com/oscartbeaumont/specta/issues/148
assert_ts!(ExtraBracketsInTupleVariant, "{ A: string }");
assert_ts!(ExtraBracketsInUnnamedStruct, "string");

// assert_ts_export!(DeprecatedType, "");
// assert_ts_export!(DeprecatedTypeWithMsg, "");
// assert_ts_export!(DeprecatedFields, "");
Expand Down Expand Up @@ -541,10 +545,21 @@ pub struct EnumReferenceRecordKey {

// https://github.com/oscartbeaumont/specta/issues/88
#[derive(Type)]
#[serde(rename_all = "camelCase")]
#[serde(export = false, rename_all = "camelCase")]
#[serde(default)]
pub(super) struct MyEmptyInput {}

#[derive(Type)]
#[specta(export = false)]
pub enum ExtraBracketsInTupleVariant {
A((String)),
}

#[derive(Type)]
#[specta(export = false)]
#[allow(unused_parens)]
pub struct ExtraBracketsInUnnamedStruct((String));

// #[derive(Type)]
// #[specta(export = false)]
// #[deprecated]
Expand Down

0 comments on commit c23c184

Please sign in to comment.