From 50855ebd32bcb3bdc9403f88fb60969bf27c0667 Mon Sep 17 00:00:00 2001 From: Landon James Date: Tue, 24 Oct 2023 13:33:46 -0700 Subject: [PATCH] Adding file extension to interface imports (#228) Adding the file extension will allow the interface imports to work for typescript packages using both `moduleResolution` `bundler` as well as `nodenext`. This is also more closely aligned with the node spec for imports so should be better supported. --- crates/js-component-bindgen/src/ts_bindgen.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/js-component-bindgen/src/ts_bindgen.rs b/crates/js-component-bindgen/src/ts_bindgen.rs index ad2f7ae38..45bbab16d 100644 --- a/crates/js-component-bindgen/src/ts_bindgen.rs +++ b/crates/js-component-bindgen/src/ts_bindgen.rs @@ -860,7 +860,7 @@ impl<'a> TsInterface<'a> { Some(owned_interface_name) => { uwriteln!( self.src, - "import type {{ {type_name} }} from '../interfaces/{owned_interface_name}';", + "import type {{ {type_name} }} from '../interfaces/{owned_interface_name}.js';", ); self.src.push_str(&format!("export {{ {} }};\n", type_name)); }