Explorar el Código

fix(compiler-sfc): fix props destructing default value type checking with unresolved type (#8340)

close #8326
Kalven Schraut hace 3 años
padre
commit
f69dbabf87
Se han modificado 1 ficheros con 1 adiciones y 5 borrados
  1. 1 5
      packages/compiler-sfc/src/script/defineProps.ts

+ 1 - 5
packages/compiler-sfc/src/script/defineProps.ts

@@ -311,11 +311,7 @@ function genDestructuredDefaultValue(
     const value = ctx.getString(defaultVal)
     const unwrapped = unwrapTSNode(defaultVal)
 
-    if (
-      inferredType &&
-      inferredType.length &&
-      !inferredType.includes(UNKNOWN_TYPE)
-    ) {
+    if (inferredType && inferredType.length && !inferredType.includes('null')) {
       const valueType = inferValueType(unwrapped)
       if (valueType && !inferredType.includes(valueType)) {
         ctx.error(