Skip to content

Commit

Permalink
fix: type of ?? expression node (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorn0 committed Jan 17, 2023
1 parent da7b6c8 commit 8b94458
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const transform = (
const tLeft = _t<b.Expression>(left);
const tRight = _t<b.Expression>(right);
return _c<b.LogicalExpression | b.BinaryExpression>(
operation === '&&' || operation === '||'
operation === '&&' || operation === '||' || operation === '??'
? 'LogicalExpression'
: 'BinaryExpression',
{
Expand Down
1 change: 1 addition & 0 deletions tests/transform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe.each`
beforeType | afterType | input | action | binding | simple | interpolation
${'Binary'} | ${'BinaryExpression'} | ${' 0 - 1 '} | ${true} | ${true} | ${true} | ${true}
${'Binary'} | ${'LogicalExpression'} | ${' a && b '} | ${true} | ${true} | ${true} | ${true}
${'Binary'} | ${'LogicalExpression'} | ${' a ?? b '} | ${true} | ${true} | ${true} | ${true}
${'Unary'} | ${'UnaryExpression'} | ${' - 1 '} | ${true} | ${true} | ${true} | ${true}
${'Unary'} | ${'UnaryExpression'} | ${' + 1 '} | ${true} | ${true} | ${true} | ${true}
${'BindingPipe'} | ${'NGPipeExpression'} | ${' a | b '} | ${false} | ${true} | ${false} | ${true}
Expand Down

0 comments on commit 8b94458

Please sign in to comment.