From 07f6793e99425c9361f14a28a6d18c3d56727ee9 Mon Sep 17 00:00:00 2001 From: Jasper Dansercoer Date: Fri, 5 Apr 2024 10:54:39 +0200 Subject: [PATCH] Fixed empty line in models --- crates/dojo-bindgen/src/plugins/typescript_new/mod.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/dojo-bindgen/src/plugins/typescript_new/mod.rs b/crates/dojo-bindgen/src/plugins/typescript_new/mod.rs index ac3161a5e1..e6b231c008 100644 --- a/crates/dojo-bindgen/src/plugins/typescript_new/mod.rs +++ b/crates/dojo-bindgen/src/plugins/typescript_new/mod.rs @@ -430,7 +430,7 @@ function convertQueryToToriiClause(query: Query): Clause | undefined {{ // This will be formatted into a TypeScript interface // using TypeScript defined types fn format_struct(token: &Composite, handled_tokens: &[Composite]) -> String { - let mut native_fields = String::new(); + let mut native_fields: Vec = Vec::new(); for field in &token.inners { let mapped = TypeScriptV2Plugin::map_type(field.token.type_name().as_str()); @@ -440,13 +440,12 @@ function convertQueryToToriiClause(query: Query): Clause | undefined {{ .find(|t| t.type_name() == field.token.type_name()) .unwrap_or_else(|| panic!("Token not found: {}", field.token.type_name())); if token.r#type == CompositeType::Enum { - native_fields += format!("{}: {};\n ", field.name, mapped).as_str(); + native_fields.push(format!("{}: {};", field.name, mapped)); } else { - native_fields += - format!("{}: {};\n ", field.name, field.token.type_name()).as_str(); + native_fields.push(format!("{}: {};", field.name, field.token.type_name())); } } else { - native_fields += format!("{}: {};\n ", field.name, mapped).as_str(); + native_fields.push(format!("{}: {};", field.name, mapped)); } } @@ -459,7 +458,7 @@ export interface {name} {{ ", path = token.type_path, name = token.type_name(), - native_fields = native_fields + native_fields = native_fields.join("\n ") ) }