mongo-types icon indicating copy to clipboard operation
mongo-types copied to clipboard

list overloads don't handle nullability correctly

Open chdsbd opened this issue 4 years ago • 1 comments

    class Post:
        user = fields.ListField(fields.StringField())

    post = Post()
    # should be 'list[str | None] | None' since user is not required and StringField is not required.
    reveal_type(post.user) # Revealed type is 'list[str]'

related: https://github.com/python/mypy/issues/10312

chdsbd avatar Apr 15 '21 04:04 chdsbd

I closed the wrong issue!

chdsbd avatar Jun 03 '21 20:06 chdsbd