File tree Expand file tree Collapse file tree 7 files changed +11
-11
lines changed
can_generate_algebraic_enum_with_skipped_variants
can_generate_empty_algebraic_enum
can_generate_generic_struct
can_handle_anonymous_struct Expand file tree Collapse file tree 7 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 1
1
/** This is a comment. */
2
2
export type Colors =
3
- | { type : "Red" , content ?: undefined }
4
- | { type : "Blue" , content ?: undefined }
3
+ | { type : "Red" , content : null }
4
+ | { type : "Blue" , content : null }
5
5
| { type : "Green" , content : string } ;
6
6
Original file line number Diff line number Diff line change 1
1
export type SomeEnum =
2
- | { type : "A" , content ?: undefined }
2
+ | { type : "A" , content : null }
3
3
| { type : "C" , content : number } ;
4
4
Original file line number Diff line number Diff line change @@ -3,5 +3,5 @@ export interface AddressDetails {
3
3
4
4
export type Address =
5
5
| { type : "FixedAddress" , content : AddressDetails }
6
- | { type : "NoFixedAddress" , content ?: undefined } ;
6
+ | { type : "NoFixedAddress" , content : null } ;
7
7
Original file line number Diff line number Diff line change @@ -13,5 +13,5 @@ export type EnumUsingGenericStruct =
13
13
| { type : "VariantA" , content : GenericStruct < string , number > }
14
14
| { type : "VariantB" , content : GenericStruct < string , number > }
15
15
| { type : "VariantC" , content : GenericStruct < string , boolean > }
16
- | { type : "VariantD" , content : GenericStructUsingGenericStruct < undefined > } ;
16
+ | { type : "VariantD" , content : GenericStructUsingGenericStruct < null > } ;
17
17
Original file line number Diff line number Diff line change @@ -15,13 +15,13 @@ export type AutofilledBy =
15
15
16
16
/** This is a comment (yareek sameek wuz here) */
17
17
export type EnumWithManyVariants =
18
- | { type : "UnitVariant" , content ?: undefined }
18
+ | { type : "UnitVariant" , content : null }
19
19
| { type : "TupleVariantString" , content : string }
20
20
| { type : "AnonVariant" , content : {
21
21
uuid : string ;
22
22
} }
23
23
| { type : "TupleVariantInt" , content : number }
24
- | { type : "AnotherUnitVariant" , content ?: undefined }
24
+ | { type : "AnotherUnitVariant" , content : null }
25
25
| { type : "AnotherAnonVariant" , content : {
26
26
uuid : string ;
27
27
thing : number ;
Original file line number Diff line number Diff line change 1
1
/** This struct has a unit field */
2
2
export interface StructHasVoidType {
3
- thisIsAUnit : undefined ;
3
+ thisIsAUnit : null ;
4
4
}
5
5
6
6
/** This enum has a variant associated with unit data */
7
7
export type EnumHasVoidType =
8
- | { type : "hasAUnit" , content : undefined } ;
8
+ | { type : "hasAUnit" , content : null } ;
9
9
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ impl Language for TypeScript {
52
52
} ,
53
53
self . format_type( rtype2, generic_types) ?
54
54
) ) ,
55
- SpecialRustType :: Unit => Ok ( "undefined " . into ( ) ) ,
55
+ SpecialRustType :: Unit => Ok ( "null " . into ( ) ) ,
56
56
SpecialRustType :: String => Ok ( "string" . into ( ) ) ,
57
57
SpecialRustType :: I8
58
58
| SpecialRustType :: U8
@@ -188,7 +188,7 @@ impl TypeScript {
188
188
match v {
189
189
RustEnumVariant :: Unit ( shared) => write ! (
190
190
w,
191
- "\t | {{ {}: {:?}, {}?: undefined }}" ,
191
+ "\t | {{ {}: {:?}, {}: null }}" ,
192
192
tag_key, shared. id. renamed, content_key
193
193
) ,
194
194
RustEnumVariant :: Tuple { ty, shared } => {
You can’t perform that action at this time.
0 commit comments