fn demo() -> impl Type
.Specta can be used in your application either directly or through a library which simplifies the process of using it.
Add specta
as a dependency to your project,
enabling the languages you want to export to:
bash
cargo add specta --features typescript # only 'typescript' is currently supported
Then you can use Specta like so:
```rust use specta::{ts, Type};
pub struct TypeOne {
pub a: String,
pub b: GenericType
pub struct GenericType { pub my_field: String, pub generic: A, }
pub enum MyEnum { A, B, C, }
fn main() {
asserteq!(
ts::export::
Check out the docs for more information.
This library was originally created to power the type exporting functionality of rspc, but after building it we realized that it could be useful for other projects as well so we decided to move it into a dedicated library.
A huge thanks to Brendonovich for doing a heap of development on this library.