use specta::{ResolvedTypes, Type, Types};
use specta_typescript::{Any, Layout, Typescript, primitives};
#[derive(Type)]
pub struct Testing {
field: Any,
}
mod nested {
#[derive(specta::Type)]
pub struct Another {
field: super::Testing,
field2: super::another::Bruh,
}
}
mod another {
#[derive(specta::Type)]
pub struct Bruh {
field: u32,
field2: bruh::Testing,
}
mod bruh {
#[derive(specta::Type)]
pub struct Testing {
field: dev::Testing,
}
mod dev {
#[derive(specta::Type)]
pub struct Testing {
field: u32,
}
}
}
}
fn main() {
let ts = Typescript::default();
ts.layout(Layout::Namespaces)
.export_to(
"demo.ts",
&ResolvedTypes::from_resolved_types(Types::default().register::<nested::Another>()),
)
.unwrap();
}