Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from May 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 1 addition & 5 deletions packages/compiler-sfc/src/script/defineProps.ts
Expand Up @@ -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(
Expand Down