@@ -717,7 +717,13 @@ impl<'a> TsInterface<'a> {
717
717
. payload_type_of_option_result_of_next_method_of_resource ( & self . resolve )
718
718
{
719
719
let iface = self . resources . get_mut ( resource) . unwrap ( ) ;
720
- iface. src . push_str ( & "[Symbol.iterator](): Iterator<" ) ;
720
+ iface. src . push_str ( & format ! (
721
+ "
722
+ /**
723
+ * Implements the `Symbol.iterator` API for `{resource}`.
724
+ [Symbol.iterator](): Iterator<
725
+ "
726
+ ) ) ;
721
727
iface. print_ty ( & payload) ;
722
728
iface. src . push_str ( ">;\n " ) ;
723
729
}
@@ -920,8 +926,9 @@ impl<'a> TsInterface<'a> {
920
926
Type :: Id ( id) . variant_case_type_defs_where_they_are_all_handles ( self . resolve )
921
927
{
922
928
self . docs ( docs) ;
929
+ let type_union_name = name. to_upper_camel_case ( ) ;
923
930
self . src
924
- . push_str ( & format ! ( "export type {} = " , name . to_upper_camel_case ( ) ) ) ;
931
+ . push_str ( & format ! ( "export type {type_union_name } = " ) ) ;
925
932
for ( i, case_type_def) in case_type_defs. iter ( ) . enumerate ( ) {
926
933
if i > 0 {
927
934
self . src . push_str ( " | " ) ;
@@ -931,14 +938,26 @@ impl<'a> TsInterface<'a> {
931
938
}
932
939
self . src . push_str ( ";\n " ) ;
933
940
934
- let type_enum_name = format ! ( "{}_type" , name ) . to_upper_camel_case ( ) ;
941
+ let type_enum_name = format ! ( "{type_union_name}Type" ) ;
935
942
936
- self . src
937
- . push_str ( & format ! ( "export enum {type_enum_name} {{\n " ) ) ;
943
+ self . src . push_str ( & format ! (
944
+ "
945
+ /**
946
+ * Enumerates different variants of the `{type_union_name}` type.
947
+ */
948
+ export enum {type_enum_name} {{
949
+ "
950
+ ) ) ;
938
951
for type_def in & case_type_defs {
939
952
let class_name = type_def. name . as_ref ( ) . unwrap ( ) . to_upper_camel_case ( ) ;
940
- self . src
941
- . push_str ( & format ! ( "{class_name} = '{class_name}',\n " ) ) ;
953
+ self . src . push_str ( & format ! (
954
+ "
955
+ /**
956
+ * Represents a variant of type `{class_name}`.
957
+ */
958
+ {class_name} = '{class_name}',
959
+ "
960
+ ) ) ;
942
961
}
943
962
self . src . push_str ( "}\n " ) ;
944
963
0 commit comments