From ec81f0691fe80eb7c075c4a7ec1d703c03980635 Mon Sep 17 00:00:00 2001 From: abcd-ca Date: Sun, 3 Mar 2024 23:30:53 -0800 Subject: [PATCH 1/2] ignore RustRover (IntelliJ) IDE settings file --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 49ec791..ca39bc5 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ Cargo.lock # These are backup files generated by rustfmt **/*.rs.bk +/.idea From 73e655be69814e90b8f192fde4f21d8c06dac6bd Mon Sep 17 00:00:00 2001 From: abcd-ca Date: Sun, 3 Mar 2024 23:32:25 -0800 Subject: [PATCH 2/2] switch from namespace to module syntax Vite (https://vitejs.dev/) is not able to handle that syntax for some reason --- src/emit.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/emit.rs b/src/emit.rs index 6644cbd..8bddea0 100644 --- a/src/emit.rs +++ b/src/emit.rs @@ -520,9 +520,6 @@ impl EmitCtx<'_> { }, generic_args, }) => { - if let Some(root_namespace) = self.root_namespace { - write!(self.w, "{}.", root_namespace)?; - } for path_part in *path { path_part.emit(self)?; write!(self.w, ".")?; @@ -614,8 +611,7 @@ where writeln!(&mut ctx.w, "{}", header)?; } if let Some(root_namespace) = options.root_namespace { - writeln!(&mut ctx.w, "export default {};", root_namespace)?; - writeln!(&mut ctx.w, "export namespace {} {{", root_namespace)?; + writeln!(&mut ctx.w, r#"declare module "{}" {{"#, root_namespace)?; ctx.indent(); } ctx.emit_type_def(type_infos)?;