Skip to content

GenericAPIView has missing type parameters, but when added 'type' object is not subscriptable #255

@XF-FW

Description

@XF-FW

Bug report

What's wrong

When using mypy with strict=true, it issues the following error:
Missing type parameters for generic type "GenericAPIView".

So, I check the type and add it, but I'm now getting a runtime error:
TypeError: 'type' object is not subscriptable.

I am using django_stubs_ext.monkeypatch(), which solves the problem for other similar issues.

I haven't test it on its own, but this should suffice, as a reproducible test:

from rest_framework.generics import GenericAPIView

class ShouldWorkView(GenericAPIView[None]):
   ...

How is that should be

The above example should pass, with no issues.

System information

  • OS: Arch
  • python version: 3.10
  • django version: 4.0.7
  • mypy version: 0.942
  • django-stubs version: 1.12.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions