Type checking is runtime, although if the static optimizer can figure out that a certain call will never work at compile time, it will throw a compile time error.
On the other hand, if the static optimizer can figure out that a certain call will always work at compile time, it can remove the runtime check for that part.