Repository navigation
fix(router): expose reload method on ActivatedRoute resources - #70702
Conversation
Resources managed by the Angular Router implement a `reload(): boolean` method, but `ResourceResult` typed resources on `ActivatedRoute.resources` and `ActivatedRouteSnapshot.resources` as `Record<string, Resource<unknown>>`. This caused TypeScript errors when attempting to call `.reload()` without a type assertion. This commit updates `ResourceResult` to intersect each resource with `Pick<WritableResource<unknown>, 'reload'>` so that `.reload()` is properly typed. Fixes angular#70698
3a6d609 to
dbbffde
Compare
|
I know the above comment about |
|
caretaker: please do public api review |
Don't tell me what to do!! LOL OK fine. reviewed-for: public-api |
alan-agius4
left a comment
There was a problem hiding this comment.
Reviewed-for: dev-infra
|
This PR was merged into the repository. The changes were merged into the following branches:
|
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Resources managed by the Angular Router implement a
reload(): booleanmethod, butResourceResulttyped resources onActivatedRoute.resourcesandActivatedRouteSnapshot.resourcesasRecord<string, Resource<unknown>>. This caused TypeScript errors when attempting to call.reload()without a type assertion.This commit updates
ResourceResultto intersect each resource withPick<WritableResource<unknown>, 'reload'>so that.reload()is properly typed. Additionally,Route.resourcesnow also acceptsRecord<string, Resource<unknown>>to allow returning custom or read-only resources without areloadmethod.Fixes #70698