@@ -78,7 +78,7 @@ def __map_choices_to_union(field_type, choices):
78
78
'''
79
79
if not choices :
80
80
_LOG .warning (f'No choices specified for Serializer Field: { field_type } ' )
81
- return 'any '
81
+ return 'unknown '
82
82
83
83
return ' | ' .join (f'"{ key } "' if type (key ) == str else str (key ) for key in choices .keys ())
84
84
@@ -89,7 +89,7 @@ def __map_choices_to_enum(enum_name, field_type, choices):
89
89
'''
90
90
if not choices :
91
91
_LOG .warning (f'No choices specified for Serializer Field: { field_type } ' )
92
- return 'any '
92
+ return 'unknown '
93
93
94
94
choices_enum = f"export enum { enum_name } {{\n "
95
95
for key , value in choices .items ():
@@ -120,11 +120,11 @@ def __process_field(field_name, field, context, serializer, trim_serializer_outp
120
120
ts_type = __get_trimmed_name (
121
121
field_type .__name__ , trim_serializer_output )
122
122
elif field_type in __field_mappings [context ]:
123
- ts_type = __field_mappings [context ].get (field_type , 'any ' )
123
+ ts_type = __field_mappings [context ].get (field_type , 'unknown ' )
124
124
elif (context in __mapping_overrides ) and (serializer in __mapping_overrides [context ]) \
125
125
and field_name in __mapping_overrides [context ][serializer ]:
126
126
ts_type = __mapping_overrides [context ][serializer ].get (
127
- field_name , 'any ' )
127
+ field_name , 'unknown ' )
128
128
elif field_type == serializers .PrimaryKeyRelatedField :
129
129
ts_type = "number | string"
130
130
elif hasattr (field , 'choices' ) and enum_choices :
@@ -133,7 +133,7 @@ def __process_field(field_name, field, context, serializer, trim_serializer_outp
133
133
elif hasattr (field , 'choices' ):
134
134
ts_type = __map_choices_to_union (field_type , field .choices )
135
135
else :
136
- ts_type = mappings .get (field_type , 'any ' )
136
+ ts_type = mappings .get (field_type , 'unknown ' )
137
137
if is_many :
138
138
ts_type += '[]'
139
139
0 commit comments