Skip to content

Commit ce363e5

Browse files
committed
chore: fix assertNumber for undefined value
1 parent 7d0c63f commit ce363e5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/runtime-core/src/warning.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ function formatProp(key: string, value: unknown, raw?: boolean): any {
168168
*/
169169
export function assertNumber(val: unknown, type: string) {
170170
if (!__DEV__) return
171-
if (typeof val !== 'number') {
171+
if (val === undefined) {
172+
return
173+
} else if (typeof val !== 'number') {
172174
warn(`${type} is not a valid number - ` + `got ${JSON.stringify(val)}.`)
173175
} else if (isNaN(val)) {
174176
warn(`${type} is NaN - ` + 'the duration expression might be incorrect.')

packages/runtime-dom/src/components/Transition.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,9 @@ function normalizeDuration(
283283

284284
function NumberOf(val: unknown): number {
285285
const res = toNumber(val)
286-
if (__DEV__) assertNumber(res, '<transition> explicit duration')
286+
if (__DEV__) {
287+
assertNumber(res, '<transition> explicit duration')
288+
}
287289
return res
288290
}
289291

0 commit comments

Comments
 (0)