Skip to content

Commit ba4cec3

Browse files
authored
fix(compiler-sfc): infer runtime type in defineProps (#7972)
1 parent ba9c2ae commit ba4cec3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/compiler-sfc/src/compileScript.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -2129,7 +2129,7 @@ function inferRuntimeType(
21292129
case 'BigIntLiteral':
21302130
return ['Number']
21312131
default:
2132-
return [`UNKNOWN`]
2132+
return [UNKNOWN_TYPE]
21332133
}
21342134

21352135
case 'TSTypeReference':
@@ -2177,13 +2177,15 @@ function inferRuntimeType(
21772177
declaredTypes
21782178
).filter(t => t !== 'null')
21792179
}
2180+
break
21802181
case 'Extract':
21812182
if (node.typeParameters && node.typeParameters.params[1]) {
21822183
return inferRuntimeType(
21832184
node.typeParameters.params[1],
21842185
declaredTypes
21852186
)
21862187
}
2188+
break
21872189
case 'Exclude':
21882190
case 'OmitThisParameter':
21892191
if (node.typeParameters && node.typeParameters.params[0]) {
@@ -2192,9 +2194,10 @@ function inferRuntimeType(
21922194
declaredTypes
21932195
)
21942196
}
2195-
// cannot infer, fallback to UNKNOWN: ThisParameterType
2197+
break
21962198
}
21972199
}
2200+
// cannot infer, fallback to UNKNOWN: ThisParameterType
21982201
return [UNKNOWN_TYPE]
21992202

22002203
case 'TSParenthesizedType':

0 commit comments

Comments
 (0)