Browse Source

fix(compiler-sfc): infer runtime type in defineProps (#7972)

pull/7988/head
三咲智子 Kevin Deng 2 years ago
committed by GitHub
parent
commit
ba4cec31b9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      packages/compiler-sfc/src/compileScript.ts

7
packages/compiler-sfc/src/compileScript.ts

@ -2129,7 +2129,7 @@ function inferRuntimeType(
case 'BigIntLiteral':
return ['Number']
default:
return [`UNKNOWN`]
return [UNKNOWN_TYPE]
}
case 'TSTypeReference':
@ -2177,6 +2177,7 @@ function inferRuntimeType(
declaredTypes
).filter(t => t !== 'null')
}
break
case 'Extract':
if (node.typeParameters && node.typeParameters.params[1]) {
return inferRuntimeType(
@ -2184,6 +2185,7 @@ function inferRuntimeType(
declaredTypes
)
}
break
case 'Exclude':
case 'OmitThisParameter':
if (node.typeParameters && node.typeParameters.params[0]) {
@ -2192,9 +2194,10 @@ function inferRuntimeType(
declaredTypes
)
}
// cannot infer, fallback to UNKNOWN: ThisParameterType
break
}
}
// cannot infer, fallback to UNKNOWN: ThisParameterType
return [UNKNOWN_TYPE]
case 'TSParenthesizedType':

Loading…
Cancel
Save