fix(defineProps): defineProps generates unnecessary array of same types (#4353)

fix #4352
This commit is contained in:
webfansplz
2021-08-17 05:40:00 +08:00
committed by GitHub
parent 77223df2d2
commit ad66295cb3
3 changed files with 9 additions and 8 deletions

View File

@@ -1703,7 +1703,7 @@ function inferRuntimeType(
return [
...new Set(
[].concat(
node.types.map(t => inferRuntimeType(t, declaredTypes)) as any
...(node.types.map(t => inferRuntimeType(t, declaredTypes)) as any)
)
)
]
@@ -1716,11 +1716,7 @@ function inferRuntimeType(
}
function toRuntimeTypeString(types: string[]) {
return types.some(t => t === 'null')
? `null`
: types.length > 1
? `[${types.join(', ')}]`
: types[0]
return types.length > 1 ? `[${types.join(', ')}]` : types[0]
}
function extractRuntimeEmits(