Skip to content

Commit

Permalink
fix(compiler-sfc): infer TS Extract&Exclude runtime type
Browse files Browse the repository at this point in the history
closes #7337
  • Loading branch information
sxzz committed Feb 4, 2023
1 parent dbe7109 commit 5f5c5b0
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/compiler-sfc/src/compileScript.ts
Expand Up @@ -1964,11 +1964,26 @@ function inferRuntimeType(
case 'Readonly':
case 'Pick':
case 'Omit':
case 'Exclude':
case 'Extract':
case 'Required':
case 'InstanceType':
return ['Object']

case 'Extract':
if (node.typeParameters && node.typeParameters.params[1]) {
return inferRuntimeType(
node.typeParameters.params[1],
declaredTypes
)
}
return ['null']
case 'Exclude':
if (node.typeParameters && node.typeParameters.params[0]) {
return inferRuntimeType(
node.typeParameters.params[0],
declaredTypes
)
}
return ['null']
}
}
return [`null`]
Expand Down

0 comments on commit 5f5c5b0

Please sign in to comment.