Skip to content

Commit 6b2d1f3

Browse files
committed
add reference type paths to generated file
Signed-off-by: Karthik Ganeshram <[email protected]>
1 parent 8ce806a commit 6b2d1f3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/commands/add.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,16 +560,22 @@ async fn generate_ts_bindings(
560560
},
561561
)?;
562562

563+
let mut reference_types = Vec::new();
564+
563565
for (name, contents) in files.iter() {
564566
let output_path = package_dir.join("types").join(name);
565567
// Create parent directories if they don't exist
566568
if let Some(parent) = output_path.parent() {
567569
fs::create_dir_all(parent).await?;
568570
}
571+
572+
reference_types.push(format!("/// <reference path=\"./types/{name}\" />\n",));
573+
println!("Writing {name} to {output_path:?}");
569574
fs::write(output_path, contents).await?;
570575
}
571576
// for all interface names in interfaces, import and re-export them in a index.js file
572577
let mut re_exports: Vec<String> = Vec::new();
578+
re_exports.push(reference_types.join("\n"));
573579
let mut name_counts: HashMap<String, usize> = HashMap::new();
574580
for (_, item) in resolve.worlds[out_world_id].imports.iter() {
575581
match item {

0 commit comments

Comments
 (0)