To put it very concisely, these are I believe the two most important advantages of static typing:
- It removes whole class of potential bugs. Essentially all the
undefined is not a function-style bugs are impossible in static type-systems. This means easier testing but also that less ‘defensive programming’ is required. - Knowing that something is guaranteed to e.g. always be an integer allows for extra optimizations to happen.