public function asClass(string $className)
    {
        if (!is_a($className, $this->class->getClassName(), true)) {
            throw InvalidArgumentException::format(
                    'Invalid call to %s: class name must be compatible with type %s, %s given',
                    __METHOD__, $this->class->getClassName(), $className
            );
        }

        $this->fromCallback(function () use ($className) {
            return $className;
        });
    }