@@ -427,20 +427,31 @@ class Transformer extends Source {
427
427
) ;
428
428
}
429
429
430
- const isPrefixNot = node instanceof angular . PrefixNot ;
431
- if ( isPrefixNot || node instanceof angular . TypeofExpression ) {
430
+ if (
431
+ node instanceof angular . PrefixNot ||
432
+ node instanceof angular . TypeofExpression ||
433
+ node instanceof angular . VoidExpression
434
+ ) {
432
435
const expression = this . #transform< babel . Expression > ( node . expression ) ;
433
436
434
- const operator = isPrefixNot ? '!' : 'typeof' ;
437
+ const operator =
438
+ node instanceof angular . PrefixNot
439
+ ? '!'
440
+ : node instanceof angular . TypeofExpression
441
+ ? 'typeof'
442
+ : node instanceof angular . VoidExpression
443
+ ? 'void'
444
+ : undefined ;
445
+
435
446
let { start } = node . sourceSpan ;
436
447
437
- if ( ! isPrefixNot ) {
448
+ if ( operator === 'typeof' || operator === 'void' ) {
438
449
const index = this . text . lastIndexOf ( operator , start ) ;
439
450
440
451
// istanbul ignore next 7
441
452
if ( index === - 1 ) {
442
453
throw new Error (
443
- `Cannot find operator ${ operator } from index ${ start } in ${ JSON . stringify (
454
+ `Cannot find operator ' ${ operator } ' from index ${ start } in ${ JSON . stringify (
444
455
this . text ,
445
456
) } `,
446
457
) ;
@@ -619,6 +630,7 @@ type SupportedNodes =
619
630
| angular . EmptyExpr
620
631
| angular . PrefixNot
621
632
| angular . TypeofExpression
633
+ | angular . VoidExpression
622
634
| angular . TemplateLiteral ; // Including `TemplateLiteralElement`
623
635
function transform ( node : SupportedNodes , text : string ) : NGNode {
624
636
return new Transformer ( node , text ) . node ;
0 commit comments