If I activate type-checking in VS Code this will highlight an error, although the python interpreter will indeed try to run it without compile time error
As I said, for my side projects this is enough for me to model my problems properly without having to resort to multiple hacks
And I took Python as an example, I also enjoy using Ocaml and Rust
def g(a: A | None): a.f()
(edit: I don't know how to format code on HN)
If I activate type-checking in VS Code this will highlight an error, although the python interpreter will indeed try to run it without compile time error
As I said, for my side projects this is enough for me to model my problems properly without having to resort to multiple hacks
And I took Python as an example, I also enjoy using Ocaml and Rust