*/
export function assertNumber(val: unknown, type: string) {
if (!__DEV__) return
- if (typeof val !== 'number') {
+ if (val === undefined) {
+ return
+ } else if (typeof val !== 'number') {
warn(`${type} is not a valid number - ` + `got ${JSON.stringify(val)}.`)
} else if (isNaN(val)) {
warn(`${type} is NaN - ` + 'the duration expression might be incorrect.')
function NumberOf(val: unknown): number {
const res = toNumber(val)
- if (__DEV__) assertNumber(res, '<transition> explicit duration')
+ if (__DEV__) {
+ assertNumber(res, '<transition> explicit duration')
+ }
return res
}