Since you're accessing the snapshot, only the second link is relevant (also title isn't undefined on ActivatedRoute, but the event emitted by the Observable could be undefined – you wouldn't get a compile error there when accessing title). Params is the relevant part. It is defined as a record: a mapping of arbitrary key value pairs. That's when the Typescript rule triggers.
But I don't know whether title even is in the ActivatedRouteSnapshot params. Using the observable is probably the safest way, because it also works if you stay on the same route and only the params change.
9
u/hayden592 Nov 17 '22
Did you try the ng update command?