@@ -20,12 +20,12 @@ describe('type check blocks', () => {
2020
2121  it ( 'should generate literal map expressions' ,  ( )  =>  { 
2222    const  TEMPLATE  =  '{{ method({foo: a, bar: b}) }}' ; 
23-     expect ( tcb ( TEMPLATE ) ) . toContain ( '((( ctx).method)) ({ "foo": ((ctx).a), "bar": ((ctx).b) })' ) ; 
23+     expect ( tcb ( TEMPLATE ) ) . toContain ( '(ctx).method({ "foo": ((ctx).a), "bar": ((ctx).b) })' ) ; 
2424  } ) ; 
2525
2626  it ( 'should generate literal array expressions' ,  ( )  =>  { 
2727    const  TEMPLATE  =  '{{ method([a, b]) }}' ; 
28-     expect ( tcb ( TEMPLATE ) ) . toContain ( '((( ctx).method)) ([((ctx).a), ((ctx).b)])' ) ; 
28+     expect ( tcb ( TEMPLATE ) ) . toContain ( '(ctx).method([((ctx).a), ((ctx).b)])' ) ; 
2929  } ) ; 
3030
3131  it ( 'should handle non-null assertions' ,  ( )  =>  { 
@@ -115,7 +115,7 @@ describe('type check blocks', () => {
115115  it ( 'should handle method calls of template variables' ,  ( )  =>  { 
116116    const  TEMPLATE  =  `<ng-template let-a>{{a(1)}}</ng-template>` ; 
117117    expect ( tcb ( TEMPLATE ) ) . toContain ( 'var _t2 = _t1.$implicit;' ) ; 
118-     expect ( tcb ( TEMPLATE ) ) . toContain ( '( _t2) (1)' ) ; 
118+     expect ( tcb ( TEMPLATE ) ) . toContain ( '_t2(1)' ) ; 
119119  } ) ; 
120120
121121  it ( 'should handle implicit vars when using microsyntax' ,  ( )  =>  { 
@@ -126,7 +126,7 @@ describe('type check blocks', () => {
126126  it ( 'should handle direct calls of an implicit template variable' ,  ( )  =>  { 
127127    const  TEMPLATE  =  `<div *ngFor="let a of letters">{{a(1)}}</div>` ; 
128128    expect ( tcb ( TEMPLATE ) ) . toContain ( 'var _t2 = _t1.$implicit;' ) ; 
129-     expect ( tcb ( TEMPLATE ) ) . toContain ( '( _t2) (1)' ) ; 
129+     expect ( tcb ( TEMPLATE ) ) . toContain ( '_t2(1)' ) ; 
130130  } ) ; 
131131
132132  describe ( 'type constructors' ,  ( )  =>  { 
@@ -609,13 +609,13 @@ describe('type check blocks', () => {
609609  it ( 'should handle $any accessed through `this`' ,  ( )  =>  { 
610610    const  TEMPLATE  =  `{{this.$any(a)}}` ; 
611611    const  block  =  tcb ( TEMPLATE ) ; 
612-     expect ( block ) . toContain ( '(((( ctx).$any)) (((ctx).a)))' ) ; 
612+     expect ( block ) . toContain ( '((ctx).$any(((ctx).a)))' ) ; 
613613  } ) ; 
614614
615615  it ( 'should handle $any accessed through a property read' ,  ( )  =>  { 
616616    const  TEMPLATE  =  `{{foo.$any(a)}}` ; 
617617    const  block  =  tcb ( TEMPLATE ) ; 
618-     expect ( block ) . toContain ( '(((((( ctx).foo)).$any)) (((ctx).a)))' ) ; 
618+     expect ( block ) . toContain ( '((((ctx).foo)).$any(((ctx).a)))' ) ; 
619619  } ) ; 
620620
621621  describe ( 'experimental DOM checking via lib.dom.d.ts' ,  ( )  =>  { 
@@ -688,28 +688,27 @@ describe('type check blocks', () => {
688688      const  TEMPLATE  =  `<div dir (dirOutput)="foo($event)"></div>` ; 
689689      const  block  =  tcb ( TEMPLATE ,  DIRECTIVES ) ; 
690690      expect ( block ) . toContain ( 
691-           '_t1["outputField"].subscribe(function ($event): any { ((( ctx).foo)) ($event); });' ) ; 
691+           '_t1["outputField"].subscribe(function ($event): any { (ctx).foo($event); });' ) ; 
692692    } ) ; 
693693
694694    it ( 'should emit a listener function with AnimationEvent for animation events' ,  ( )  =>  { 
695695      const  TEMPLATE  =  `<div (@animation.done)="foo($event)"></div>` ; 
696696      const  block  =  tcb ( TEMPLATE ) ; 
697-       expect ( block ) . toContain ( 
698-           'function ($event: i1.AnimationEvent): any { (((ctx).foo))($event); }' ) ; 
697+       expect ( block ) . toContain ( 'function ($event: i1.AnimationEvent): any { (ctx).foo($event); }' ) ; 
699698    } ) ; 
700699
701700    it ( 'should emit addEventListener calls for unclaimed outputs' ,  ( )  =>  { 
702701      const  TEMPLATE  =  `<div (event)="foo($event)"></div>` ; 
703702      const  block  =  tcb ( TEMPLATE ) ; 
704703      expect ( block ) . toContain ( 
705-           '_t1.addEventListener("event", function ($event): any { ((( ctx).foo)) ($event); });' ) ; 
704+           '_t1.addEventListener("event", function ($event): any { (ctx).foo($event); });' ) ; 
706705    } ) ; 
707706
708707    it ( 'should allow to cast $event using $any' ,  ( )  =>  { 
709708      const  TEMPLATE  =  `<div (event)="foo($any($event))"></div>` ; 
710709      const  block  =  tcb ( TEMPLATE ) ; 
711710      expect ( block ) . toContain ( 
712-           '_t1.addEventListener("event", function ($event): any { ((( ctx).foo)) (($event as any)); });' ) ; 
711+           '_t1.addEventListener("event", function ($event): any { (ctx).foo(($event as any)); });' ) ; 
713712    } ) ; 
714713
715714    it ( 'should detect writes to template variables' ,  ( )  =>  { 
@@ -724,7 +723,7 @@ describe('type check blocks', () => {
724723      const  block  =  tcb ( TEMPLATE ) ; 
725724
726725      expect ( block ) . toContain ( 
727-           '_t1.addEventListener("event", function ($event): any { ((( ctx).foo)) (((ctx).$event)); });' ) ; 
726+           '_t1.addEventListener("event", function ($event): any { (ctx).foo(((ctx).$event)); });' ) ; 
728727    } ) ; 
729728  } ) ; 
730729
@@ -852,18 +851,18 @@ describe('type check blocks', () => {
852851      it ( 'should check types of directive outputs when enabled' ,  ( )  =>  { 
853852        const  block  =  tcb ( TEMPLATE ,  DIRECTIVES ) ; 
854853        expect ( block ) . toContain ( 
855-             '_t1["outputField"].subscribe(function ($event): any { ((( ctx).foo)) ($event); });' ) ; 
854+             '_t1["outputField"].subscribe(function ($event): any { (ctx).foo($event); });' ) ; 
856855        expect ( block ) . toContain ( 
857-             '_t2.addEventListener("nonDirOutput", function ($event): any { ((( ctx).foo)) ($event); });' ) ; 
856+             '_t2.addEventListener("nonDirOutput", function ($event): any { (ctx).foo($event); });' ) ; 
858857      } ) ; 
859858      it ( 'should not check types of directive outputs when disabled' ,  ( )  =>  { 
860859        const  DISABLED_CONFIG :
861860            TypeCheckingConfig  =  { ...BASE_CONFIG ,  checkTypeOfOutputEvents : false } ; 
862861        const  block  =  tcb ( TEMPLATE ,  DIRECTIVES ,  DISABLED_CONFIG ) ; 
863-         expect ( block ) . toContain ( 'function ($event: any): any { ((( ctx).foo)) ($event); }' ) ; 
862+         expect ( block ) . toContain ( 'function ($event: any): any { (ctx).foo($event); }' ) ; 
864863        // Note that DOM events are still checked, that is controlled by `checkTypeOfDomEvents` 
865864        expect ( block ) . toContain ( 
866-             'addEventListener("nonDirOutput", function ($event): any { ((( ctx).foo)) ($event); });' ) ; 
865+             'addEventListener("nonDirOutput", function ($event): any { (ctx).foo($event); });' ) ; 
867866      } ) ; 
868867    } ) ; 
869868
@@ -872,14 +871,13 @@ describe('type check blocks', () => {
872871
873872      it ( 'should check types of animation events when enabled' ,  ( )  =>  { 
874873        const  block  =  tcb ( TEMPLATE ,  DIRECTIVES ) ; 
875-         expect ( block ) . toContain ( 
876-             'function ($event: i1.AnimationEvent): any { (((ctx).foo))($event); }' ) ; 
874+         expect ( block ) . toContain ( 'function ($event: i1.AnimationEvent): any { (ctx).foo($event); }' ) ; 
877875      } ) ; 
878876      it ( 'should not check types of animation events when disabled' ,  ( )  =>  { 
879877        const  DISABLED_CONFIG :
880878            TypeCheckingConfig  =  { ...BASE_CONFIG ,  checkTypeOfAnimationEvents : false } ; 
881879        const  block  =  tcb ( TEMPLATE ,  DIRECTIVES ,  DISABLED_CONFIG ) ; 
882-         expect ( block ) . toContain ( 'function ($event: any): any { ((( ctx).foo)) ($event); }' ) ; 
880+         expect ( block ) . toContain ( 'function ($event: any): any { (ctx).foo($event); }' ) ; 
883881      } ) ; 
884882    } ) ; 
885883
@@ -889,18 +887,18 @@ describe('type check blocks', () => {
889887      it ( 'should check types of DOM events when enabled' ,  ( )  =>  { 
890888        const  block  =  tcb ( TEMPLATE ,  DIRECTIVES ) ; 
891889        expect ( block ) . toContain ( 
892-             '_t1["outputField"].subscribe(function ($event): any { ((( ctx).foo)) ($event); });' ) ; 
890+             '_t1["outputField"].subscribe(function ($event): any { (ctx).foo($event); });' ) ; 
893891        expect ( block ) . toContain ( 
894-             '_t2.addEventListener("nonDirOutput", function ($event): any { ((( ctx).foo)) ($event); });' ) ; 
892+             '_t2.addEventListener("nonDirOutput", function ($event): any { (ctx).foo($event); });' ) ; 
895893      } ) ; 
896894      it ( 'should not check types of DOM events when disabled' ,  ( )  =>  { 
897895        const  DISABLED_CONFIG : TypeCheckingConfig  =  { ...BASE_CONFIG ,  checkTypeOfDomEvents : false } ; 
898896        const  block  =  tcb ( TEMPLATE ,  DIRECTIVES ,  DISABLED_CONFIG ) ; 
899897        // Note that directive outputs are still checked, that is controlled by 
900898        // `checkTypeOfOutputEvents` 
901899        expect ( block ) . toContain ( 
902-             '_t1["outputField"].subscribe(function ($event): any { ((( ctx).foo)) ($event); });' ) ; 
903-         expect ( block ) . toContain ( 'function ($event: any): any { ((( ctx).foo)) ($event); }' ) ; 
900+             '_t1["outputField"].subscribe(function ($event): any { (ctx).foo($event); });' ) ; 
901+         expect ( block ) . toContain ( 'function ($event: any): any { (ctx).foo($event); }' ) ; 
904902      } ) ; 
905903    } ) ; 
906904
@@ -1009,15 +1007,15 @@ describe('type check blocks', () => {
10091007      it ( 'should use undefined for safe navigation operations when enabled' ,  ( )  =>  { 
10101008        const  block  =  tcb ( TEMPLATE ,  DIRECTIVES ) ; 
10111009        expect ( block ) . toContain ( 
1012-             '(null as any ? (( null as any ? (((ctx).a))!.method : undefined) )!() : undefined)' ) ; 
1010+             '(null as any ? (null as any ? (((ctx).a))!.method : undefined)!() : undefined)' ) ; 
10131011        expect ( block ) . toContain ( '(null as any ? (((ctx).a))!.b : undefined)' ) ; 
10141012        expect ( block ) . toContain ( '(null as any ? (((ctx).a))![0] : undefined)' ) ; 
10151013      } ) ; 
10161014      it ( 'should use an \'any\' type for safe navigation operations when disabled' ,  ( )  =>  { 
10171015        const  DISABLED_CONFIG :
10181016            TypeCheckingConfig  =  { ...BASE_CONFIG ,  strictSafeNavigationTypes : false } ; 
10191017        const  block  =  tcb ( TEMPLATE ,  DIRECTIVES ,  DISABLED_CONFIG ) ; 
1020-         expect ( block ) . toContain ( '((((((( ctx).a))!.method as any) ) as any)())' ) ; 
1018+         expect ( block ) . toContain ( '((((((ctx).a))!.method as any) as any)())' ) ; 
10211019        expect ( block ) . toContain ( '((((ctx).a))!.b as any)' ) ; 
10221020        expect ( block ) . toContain ( '(((((ctx).a))![0] as any)' ) ; 
10231021      } ) ; 
@@ -1027,18 +1025,18 @@ describe('type check blocks', () => {
10271025      const  TEMPLATE  =  `{{a.method()?.b}} {{a()?.method()}} {{a.method()?.[0]}}` ; 
10281026      it ( 'should check the presence of a property/method on the receiver when enabled' ,  ( )  =>  { 
10291027        const  block  =  tcb ( TEMPLATE ,  DIRECTIVES ) ; 
1030-         expect ( block ) . toContain ( '(null as any ? (((((( ctx).a)).method)) ())!.b : undefined)' ) ; 
1028+         expect ( block ) . toContain ( '(null as any ? ((((ctx).a)).method())!.b : undefined)' ) ; 
10311029        expect ( block ) . toContain ( 
1032-             '(null as any ? (( null as any ? (((( ctx).a)) ())!.method : undefined) )!() : undefined)' ) ; 
1033-         expect ( block ) . toContain ( '(null as any ? (((((( ctx).a)).method)) ())![0] : undefined)' ) ; 
1030+             '(null as any ? (null as any ? ((ctx).a())!.method : undefined)!() : undefined)' ) ; 
1031+         expect ( block ) . toContain ( '(null as any ? ((((ctx).a)).method())![0] : undefined)' ) ; 
10341032      } ) ; 
10351033      it ( 'should not check the presence of a property/method on the receiver when disabled' ,  ( )  =>  { 
10361034        const  DISABLED_CONFIG :
10371035            TypeCheckingConfig  =  { ...BASE_CONFIG ,  strictSafeNavigationTypes : false } ; 
10381036        const  block  =  tcb ( TEMPLATE ,  DIRECTIVES ,  DISABLED_CONFIG ) ; 
1039-         expect ( block ) . toContain ( '(((((((( ctx).a)).method)) ()) as any).b) ' ) ; 
1040-         expect ( block ) . toContain ( '(((((((( ctx).a)) ()) as any).method)  as any)())' ) ; 
1041-         expect ( block ) . toContain ( '(((((((( ctx).a)).method)) ()) as any)[0]) ' ) ; 
1037+         expect ( block ) . toContain ( '(((((ctx).a)).method()) as any).b' ) ; 
1038+         expect ( block ) . toContain ( '(((((ctx).a()) as any).method as any)())' ) ; 
1039+         expect ( block ) . toContain ( '(((((ctx).a)).method()) as any)[0]' ) ; 
10421040      } ) ; 
10431041    } ) ; 
10441042
0 commit comments