mirror of https://github.com/vuejs/core.git
chore: fix assertNumber for undefined value
This commit is contained in:
parent
7d0c63ff43
commit
ce363e55a8
|
@ -168,7 +168,9 @@ function formatProp(key: string, value: unknown, raw?: boolean): any {
|
|||
*/
|
||||
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.')
|
||||
|
|
|
@ -283,7 +283,9 @@ function normalizeDuration(
|
|||
|
||||
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue