Skip to content

Commit

Permalink
cli: de-duplicate IDL JSON in TS types
Browse files Browse the repository at this point in the history
  • Loading branch information
johnrees committed Dec 31, 2021
1 parent b6cbdb2 commit c239dbd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cli/src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,12 @@ pub fn idl_ts(idl: &Idl) -> Result<String> {
}
let idl_json = serde_json::to_string_pretty(&idl)?;
Ok(format!(
r#"export type {} = {};
r#"export const IDL = {} as const;
export const IDL: {} = {};
export type {} = typeof IDL;
"#,
idl.name.to_camel_case(),
idl_json,
idl.name.to_camel_case(),
idl_json
idl.name.to_camel_case()
))
}

Expand Down

0 comments on commit c239dbd

Please sign in to comment.