Copied over from phillipdupuis#28:
Example:
class MyModel(BaseModel):
my_bool_property: bool = False
Convert to TypeScript and see output:
interface MyModel {
my_bool_property?: bool;
}
I believe that the interface shouldn't define the property as optional, since Pydantic will ensure it is hydrated with the default value of false if it's not provided when creating models, e.g.:
newModel = MyModel()
assert newModel.my_bool_property is False # assertion passes
Expected TypeScript interface:
interface MyModel {
my_bool_property: bool;
}