'mypy doesn't undestand raise Exception for None value

I create a function in another function if one of the variables is None to raise ValueError. But mypy doesn't understand it, my code is:

from typing import Mapping, Optional, Union


def make_setting(name: str, age: Optional[int], score: Optional[int]) -> Mapping[str, Union[str, int]]:
    def check(the_first_name,*arg):
        if None in arg:
            raise ValueError('The args of "{}" should not be None.'.format(the_first_name))
    check(name, age, score)
    return make_setting_of_policy(name, age, score)

def make_setting_of_policy(name: str, age:int, score: int) -> Mapping[str, Union[str, int]]:
    return {'name':name, 'age':age, 'score':score}

mypy doesn't understand the input of make_setting_of_policy is not None, and shows the below error:

Argument 2 to "make_setting_of_policy" has incompatible type "Optional[int]"; expected "int"
Argument 3 to "make_setting_of_policy" has incompatible type "Optional[int]"; expected "int"


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source