Could you also annotate type so that its parameters are guaranteed to be number and not arbitrary types such as string?