Skip to content

Commit

Permalink
fix(typeEvaluator): handle access{attribute,element) when resolving c…
Browse files Browse the repository at this point in the history
…onditions
  • Loading branch information
sgulseth committed May 3, 2024
1 parent ca0cddb commit 184eb8a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/typeEvaluator/typeEvaluate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -821,9 +821,19 @@ function resolveCondition(expr: ExprNode, scope: Scope): boolean | undefined {
$trace('resolveCondition.expr %O', expr)

switch (expr.type) {
case 'AccessAttribute':
case 'AccessElement':
case 'Value': {
const value = walk({node: expr, scope})
return value.type === 'boolean' && value.value !== false
if (value.type === 'boolean') {
return value.value
}

if (value.type === 'unknown') {
return undefined
}

return false
}
case 'And': {
const left = resolveCondition(expr.left, scope)
Expand Down

0 comments on commit 184eb8a

Please sign in to comment.