@@ -261,6 +261,23 @@ fn typescript_types() {
261
261
assert_ts ! ( ExtraBracketsInTupleVariant , "{ A: string }" ) ;
262
262
assert_ts ! ( ExtraBracketsInUnnamedStruct , "string" ) ;
263
263
264
+ // https://github.com/oscartbeaumont/specta/issues/156
265
+ assert_ts ! ( Vec <MyEnum >, r#"({ A: string } | { B: number })[]"# ) ;
266
+
267
+ assert_ts ! ( InlineTuple , r#"{ demo: [string, boolean] }"# ) ;
268
+ assert_ts ! (
269
+ InlineTuple2 ,
270
+ r#"{ demo: [{ demo: [string, boolean] }, boolean] }"#
271
+ ) ;
272
+
273
+ // https://github.com/oscartbeaumont/specta/issues/220
274
+ assert_ts ! ( Box <str >, r#"string"# ) ;
275
+
276
+ assert_ts ! (
277
+ SkippedFieldWithinVariant ,
278
+ r#"{ type: "A" } | { type: "B"; data: string }"#
279
+ ) ;
280
+
264
281
// https://github.com/oscartbeaumont/specta/issues/90
265
282
assert_ts ! ( RenameWithWeirdCharsField , r#"{ "@odata.context": string }"# ) ;
266
283
assert_ts ! (
@@ -291,18 +308,6 @@ fn typescript_types() {
291
308
r#"@odata.context"# . to_string( )
292
309
)
293
310
) ;
294
-
295
- // https://github.com/oscartbeaumont/specta/issues/156
296
- assert_ts ! ( Vec <MyEnum >, r#"({ A: string } | { B: number })[]"# ) ;
297
-
298
- assert_ts ! ( InlineTuple , r#"{ demo: [string, boolean] }"# ) ;
299
- assert_ts ! (
300
- InlineTuple2 ,
301
- r#"{ demo: [{ demo: [string, boolean] }, boolean] }"#
302
- ) ;
303
-
304
- // https://github.com/oscartbeaumont/specta/issues/220
305
- assert_ts ! ( Box <str >, r#"string"# ) ;
306
311
}
307
312
308
313
#[ derive( Type ) ]
@@ -644,3 +649,10 @@ pub struct InlineTuple2 {
644
649
#[ specta( inline) ]
645
650
demo : ( InlineTuple , bool ) ,
646
651
}
652
+
653
+ #[ derive( Type ) ]
654
+ #[ serde( tag = "type" , content = "data" ) ]
655
+ pub enum SkippedFieldWithinVariant {
656
+ A ( #[ serde( skip) ] String ) ,
657
+ B ( String ) ,
658
+ }
0 commit comments