Features:
- Added support for serializers.ChoiceField. A Typescript union type is generated containing all choices specified in the serializer.
e.g.
python3
class ActionType(models.TextChoices):
ACTION1 = "Action1", ("Action1")
ACTION2 = "Action2", ("Action2")
ACTION3 = "Action3", ("Action3")
ts_interface()
class ActionSerializer(serializers.Serializer):
action = serializers.ChoiceField(choices=ActionType.choices)
will generate the following Typescript interface:
ts
export interface ActionSerializer {
action: Action1 | Action2 | Action3;
}