There's a problem in early SDK 7.4.* versions (that have been pulled back) and in SDK 8.0.0 beta with enabled strict type checking:
import Toybox.Lang;
function f(x as Number) as Number? {
// Object of type 'PolyType<Any or $.Toybox.Lang.Number...