diff --git a/ts-rs/tests/generics.rs b/ts-rs/tests/generics.rs index 11ec471..961fffc 100644 --- a/ts-rs/tests/generics.rs +++ b/ts-rs/tests/generics.rs @@ -147,8 +147,6 @@ fn generic_struct() { } #[test] -// #[ignore] -// https://github.com/Aleph-Alpha/ts-rs/issues/56 TODO fn inline() { #[derive(TS)] struct Generic { @@ -171,6 +169,56 @@ fn inline() { ); } +#[test] +#[ignore = "We haven't figured out how to inline generics with bounds yet"] +fn inline_with_bounds() { + #[derive(TS)] + struct Generic { + t: T, + } + + #[derive(TS)] + struct Container { + g: Generic, + #[ts(inline)] + gi: Generic, + #[ts(flatten)] + t: Generic, + } + + assert_eq!(Generic::<&'static str>::decl(), "type Generic = { t: T, }"); + assert_eq!( + Container::decl(), + "type Container = { g: Generic, gi: { t: string, }, t: number, }" + // Actual output: { g: Generic, gi: { t: T, }, t: T, } + ); +} + +#[test] +#[ignore = "We haven't figured out how to inline generics with defaults yet"] +fn inline_with_default() { + #[derive(TS)] + struct Generic { + t: T, + } + + #[derive(TS)] + struct Container { + g: Generic, + #[ts(inline)] + gi: Generic, + #[ts(flatten)] + t: Generic, + } + + assert_eq!(Generic::<&'static str>::decl(), "type Generic = { t: T, }"); + assert_eq!( + Container::decl(), + "type Container = { g: Generic, gi: { t: string, }, t: number, }" + // Actual output: { g: Generic, gi: { t: T, }, t: T, } + ); +} + #[test] fn default() { #[derive(TS)]