Summary
from ty_extensions import Module
def get_module() -> Module["collections.abc"]:
from collections import abc
return abc
this is already possible by using TypeOf (thank you @AlexWaygood):
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import collections.abc
from ty_extensions import TypeOf
def get_module() -> TypeOf[collections.abc]:
import collections.abc
return collections.abc