seandstewart / typical

Typical: Fast, simple, & correct data-validation using Python 3 typing.
https://python-typical.org
MIT License
183 stars 9 forks source link

TypeError if annotated typing.Deque[int] #181

Closed xbanke closed 2 years ago

xbanke commented 2 years ago

Description

import typic, typing
from collections import deque

@typic.klass
class Foo:  # OK
    a: typing.Deque = typic.field(default_factory=deque)

@typic.klass
class Bar:  # TypeError: Subscripted generics cannot be used with class and instance checks
    a: typing.Deque[int] = typic.field(default_factory=deque)