typed_dict_python
No overview available.
def typed_dict_python(
name: str,
fields: dict[str, str]
) - > str
Generates a Python TypedDict class definition from a dictionary of field names and their corresponding types.
Parameters
| Name | Type | Description |
|---|---|---|
| name | str | The name of the TypedDict class to be generated. |
| fields | dict[str, str] | A mapping where keys are field names and values are strings representing the Python types for those fields. |
Returns
| Type | Description |
|---|---|
str | A string containing the formatted Python source code for the TypedDict class definition. |