This commit is contained in:
Moritz Bischof
2020-12-19 17:29:53 +01:00
parent 57051a1a63
commit a9e5bfade3
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -72,12 +72,12 @@ fn format_field(
if type_override.is_none() {
dependencies.push(match inline {
true => quote!{ dependencies.append(&mut <#ty as ts_rs::TS>::dependencies()); },
false => quote!{
true => quote! { dependencies.append(&mut <#ty as ts_rs::TS>::dependencies()); },
false => quote! {
if <#ty as ts_rs::TS>::transparent() {
dependencies.append(&mut <#ty as ts_rs::TS>::dependencies());
} else {
dependencies.push((std::any::TypeId::of::<#ty>(), <#ty as ts_rs::TS>::name()));
dependencies.push((std::any::TypeId::of::<#ty>(), <#ty as ts_rs::TS>::name()));
}
},
});
+1 -1
View File
@@ -124,7 +124,7 @@ pub trait TS: 'static {
/// All type ids and typescript names of the types this type depends on.
/// This is used for resolving imports when using the `export!` macro.
fn dependencies() -> Vec<(TypeId, String)>;
/// `true` if this is a transparent type, e.g tuples or a list.
/// This is used for resolving imports when using the `export!` macro.
fn transparent() -> bool;