From: Kalven Schraut <30308012+kalvenschraut@users.noreply.github.com> Date: Wed, 17 May 2023 01:59:49 +0000 (-0500) Subject: fix(compiler-sfc): fix props destructing default value type checking with unresolved... X-Git-Tag: v3.3.3~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f69dbabf8794426c3e9ed33ae77dd8ce655eafd2;p=thirdparty%2Fvuejs%2Fcore.git fix(compiler-sfc): fix props destructing default value type checking with unresolved type (#8340) close #8326 --- diff --git a/packages/compiler-sfc/src/script/defineProps.ts b/packages/compiler-sfc/src/script/defineProps.ts index be99c6122e..1ae5a16e3d 100644 --- a/packages/compiler-sfc/src/script/defineProps.ts +++ b/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(