-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e08161c
commit 61f1c9c
Showing
4 changed files
with
48 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,38 @@ | ||
use std::collections::HashMap; | ||
use ts_rs::TS; | ||
|
||
#[derive(TS)] | ||
#[ts(export, export_to = "issue_338/")] | ||
pub struct MyType { | ||
pub my_field_0: bool, | ||
pub my_field_1: HashMap<MyEnum, MyStruct>, | ||
} | ||
|
||
#[derive(TS)] | ||
#[ts(export, export_to = "issue_338/")] | ||
pub enum MyEnum { | ||
Variant0, | ||
Variant1, | ||
Variant2, | ||
Variant3, | ||
} | ||
|
||
#[derive(TS)] | ||
#[ts(export, export_to = "issue_338/")] | ||
pub struct MyStruct { | ||
pub my_field_0: bool, | ||
pub my_field_1: u32, | ||
pub my_field_2: Option<u32>, | ||
pub my_field_3: Option<u32>, | ||
pub my_field_4: Option<u32>, | ||
pub my_field_5: String, | ||
} | ||
|
||
#[test] | ||
fn test() { | ||
assert_eq!( | ||
MyType::inline(), | ||
"{ my_field_0: boolean, my_field_1: { [key in MyEnum]?: MyStruct }, }" | ||
); | ||
} | ||
use std::collections::HashMap; | ||
|
||
use ts_rs::TS; | ||
|
||
#[derive(TS)] | ||
#[ts(export, export_to = "issue_338/")] | ||
pub struct MyType { | ||
pub my_field_0: bool, | ||
pub my_field_1: HashMap<MyEnum, MyStruct>, | ||
} | ||
|
||
#[derive(TS)] | ||
#[ts(export, export_to = "issue_338/")] | ||
pub enum MyEnum { | ||
Variant0, | ||
Variant1, | ||
Variant2, | ||
Variant3, | ||
} | ||
|
||
#[derive(TS)] | ||
#[ts(export, export_to = "issue_338/")] | ||
pub struct MyStruct { | ||
pub my_field_0: bool, | ||
pub my_field_1: u32, | ||
pub my_field_2: Option<u32>, | ||
pub my_field_3: Option<u32>, | ||
pub my_field_4: Option<u32>, | ||
pub my_field_5: String, | ||
} | ||
|
||
#[test] | ||
fn test() { | ||
assert_eq!( | ||
MyType::inline(), | ||
"{ my_field_0: boolean, my_field_1: { [key in MyEnum]?: MyStruct }, }" | ||
); | ||
} |