Can someone please explain to me the concept of "expression wrapping" in TypeScript and when it is needed? For example, why are the parentheses used in <[Parent, (Children[])]>?
If I define a tuple type and use it in the resolve method signature of my main code, would I still need to wrap the array of Children in parentheses?
Are there other instances in TypeScript/Angular where "expression wrapping" is required?
Is this specific to Angular? For instance, the '?' safe navigation operator seems to be an Angular extension to TypeScript rather than a part of the actual language.
type parentChildTuple = [Parent, Children[] ]
- versus
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[])]> {
}
}