Angular / Typescript expression wrapper: requires an explanation of the thumb rule when / where it is required

In this code, can someone explain the rule of thumb, why / when there is a need, what, as it seems to me, is called a wrapping expression inside Typescript? that is, '(' ')' in <[Parent, (Children [])]> .

  • If, for example, I determined the type of the tuple and used what the solution implements / the method of signing the main code, will you still need a '(' ')' wrapped around the Children array?

  • Are there other scripts in Typescript / Angular where the expression wrapper also happens?

  • Is Angular specification? For example, '?' type safe navigator I learned about Angular Typescript decoration, which is not yet part of the language. See here and here and here .

type parentChildTuple = [Parent, Children[] ] 

- against

 type parentChildTuple = [Parent, (Children[]) ] 

 import { Injectable } from '@angular/core'; import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; import { Observable } from 'rxjs'; @Injectable() export class DataComponentResolver implements Resolve<[Parent, (Children[])]> { constructor() { } resolve( route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<[Parent, (Children[])]> { } } 
+1
angular tuples typescript angular2-routing
source share
1 answer
  • What are you saying about wrapping an expression, just to make the code more understandable. It has no effect.
  • The same thing when you say: if (a> b && c <d) → if ((a> b) && (c <d))
  • Angular2 (typescript) uses typescript. '?' type safe navigator '?' type safe navigator does not exist for angular and typescript. Everything in typescript will be in angular and vice versa.
-one
source share

All Articles