Skip to content

Commit

Permalink
Adding file extension to interface imports (#228)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
landonxjames authored Oct 24, 2023
1 parent 5f321ef commit 50855eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/js-component-bindgen/src/ts_bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit 50855eb

Please sign in to comment.