]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(compiler-sfc): infer runtime type in defineProps (#7972)
author三咲智子 Kevin Deng <sxzz@sxzz.moe>
Thu, 30 Mar 2023 06:49:28 +0000 (14:49 +0800)
committerGitHub <noreply@github.com>
Thu, 30 Mar 2023 06:49:28 +0000 (14:49 +0800)
packages/compiler-sfc/src/compileScript.ts

index 96ea7df18bc063862cda0a5d15a356dc5851a031..61b4b7c0ee1f50be9586b993c5f16b251a73ee03 100644 (file)
@@ -2129,7 +2129,7 @@ function inferRuntimeType(
         case 'BigIntLiteral':
           return ['Number']
         default:
-          return [`UNKNOWN`]
+          return [UNKNOWN_TYPE]
       }
 
     case 'TSTypeReference':
@@ -2177,6 +2177,7 @@ function inferRuntimeType(
                 declaredTypes
               ).filter(t => t !== 'null')
             }
+            break
           case 'Extract':
             if (node.typeParameters && node.typeParameters.params[1]) {
               return inferRuntimeType(
@@ -2184,6 +2185,7 @@ function inferRuntimeType(
                 declaredTypes
               )
             }
+            break
           case 'Exclude':
           case 'OmitThisParameter':
             if (node.typeParameters && node.typeParameters.params[0]) {
@@ -2192,9 +2194,10 @@ function inferRuntimeType(
                 declaredTypes
               )
             }
-          // cannot infer, fallback to UNKNOWN: ThisParameterType
+            break
         }
       }
+      // cannot infer, fallback to UNKNOWN: ThisParameterType
       return [UNKNOWN_TYPE]
 
     case 'TSParenthesizedType':