Skip to content

Commit

Permalink
Fixed empty line in models
Browse files Browse the repository at this point in the history
  • Loading branch information
RareSecond committed Apr 5, 2024
1 parent a078827 commit 07f6793
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions crates/dojo-bindgen/src/plugins/typescript_new/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> = Vec::new();

for field in &token.inners {
let mapped = TypeScriptV2Plugin::map_type(field.token.type_name().as_str());
Expand All @@ -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));
}
}

Expand All @@ -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 ")
)
}

Expand Down

0 comments on commit 07f6793

Please sign in to comment.