Browse Source

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

close #8326
pull/8344/head
Kalven Schraut 2 years ago
committed by GitHub
parent
commit
f69dbabf87
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      packages/compiler-sfc/src/script/defineProps.ts

6
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(

Loading…
Cancel
Save