contains-io/typet

Add support for Generics in Object and StrictObject

dangle opened this issue · 0 comments

Currently, using Generics with Object is a pain. Initial support for casting and type validation exist, but creating the class itself is awkward as it requires creating a metaclass.

from typet import Object
from typing import Generic, GenericMeta, TypeVar

T = TypeVar('T')

class Meta(type(Object), GenericMeta): ...

class MyObject(Object, Generic[T], meta=Meta):
    value: T