What you’re describing is type hints, it’s syntactic sugar and not used at all by the interpreter.
For example, this is a “legal” statement:
foo: int = “bar”
Your IDE and linter will complain, but the interpreter just chops the hints off when compiling, and it’s left with foo = “bar”