diff --git a/example/src/lib.rs b/example/src/lib.rs index 51c6853..a81a75d 100644 --- a/example/src/lib.rs +++ b/example/src/lib.rs @@ -45,11 +45,9 @@ mod export_ts { } } -#[derive(TS)] -struct X(Vec); // this will export [Role] to `role.ts` and [User] to `user.ts`. // `export!` will also take care of including imports in typescript files. export! { Role => "role.ts", - User, X => "user.ts", + User => "user.ts", } diff --git a/ts-rs/Cargo.toml b/ts-rs/Cargo.toml index b943d8b..18d970c 100644 --- a/ts-rs/Cargo.toml +++ b/ts-rs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ts-rs" -version = "2.1.2" +version = "2.1.3" authors = ["Moritz Bischof "] edition = "2018" license = "MIT" diff --git a/ts-rs/src/export.rs b/ts-rs/src/export.rs index 6965695..f4c52fd 100644 --- a/ts-rs/src/export.rs +++ b/ts-rs/src/export.rs @@ -90,7 +90,11 @@ pub fn imports( .into_iter() .flat_map(|(id, name)| { let path = exported_files.get(&id)?; - Some((import_path(out_path, path), name)) + if path == out_path { + None + } else { + Some((import_path(out_path, path), name)) + } }) .for_each(|(path, name)| { imports