graphene-django
graphene-django copied to clipboard
Fix type hint for DjangoObjectTypeOptions.model
Proper type is typing.Type[Model], not Model
Also, according to usage, https://github.com/graphql-python/graphene-django/blob/9f26772ae02106d723ca27b88eb10660c05df8d8/graphene_django/types.py#L192
there could be added type hints for fields and exclude:
class DjangoObjectTypeOptions(ObjectTypeOptions):
...
fields = None # type: Union[List[str], Tuple[str, ...], Literal['__all__']]
exclude = None # type: Union[List[str], Tuple[str, ...]]
This would fix mismatching type hint inherited from ObjectTypeOptions.fields, which is annotated as following in graphene:
fields = None # type: Dict[str, Field]
typing.Literal is new in python3.8, so could use str instead of Literal['__all__']