# Code de la lib, pas modifiable

class CustomType:
    foo: str

    def __init__(self, foo: str):
        self.foo = foo


def lib_func(foo: str) -> CustomType:
    return CustomType(foo)


# Code perso

from typing import TypeVar, Generic, Callable, ParamSpec

T = TypeVar('T')
P = ParamSpec('P')


class Wrapper(Generic[P, T]):
    def __init__(self, func: Callable[P, T]):
        self.func = func

    def __call__(self, *args: P.args, **kwargs: P.kwargs) -> T:
        return self.func(*args, **kwargs)


wrapper = Wrapper(lib_func)
obj = wrapper('test')
reveal_type(obj)

# % mypy file.py
# file.py:32: note: Revealed type is "file.CustomType"
# Success: no issues found in 1 source file