]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: fix assertNumber for undefined value
authorEvan You <yyx990803@gmail.com>
Mon, 14 Nov 2022 08:57:44 +0000 (16:57 +0800)
committerEvan You <yyx990803@gmail.com>
Mon, 14 Nov 2022 08:57:44 +0000 (16:57 +0800)
packages/runtime-core/src/warning.ts
packages/runtime-dom/src/components/Transition.ts

index b314985b7713c55262e75d7b36e9af91978d6339..8e93d9efe59da24f1306fc3fbce5ef88cdb8d60d 100644 (file)
@@ -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.')
index 205bea9668fc094cfa8b19dbab8ed220a7015a62..a331c53c2352e372df5d28fe4dc2cbb1c0c7af00 100644 (file)
@@ -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
 }