소스 검색

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

close #8326
Kalven Schraut 3 년 전
부모
커밋
f69dbabf87
1개의 변경된 파일1개의 추가작업 그리고 5개의 파일을 삭제
  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(