Repository navigation
bug/docs?: router resources and reloading ability is conflicting with types and docs #70698
Description
Which @angular/* package(s) are the source of the bug?
router
Is this a regression?
No
Description
The router resource preview docs say that router resources can be reloaded like so:
export class UserProfile {
user = input.required<User>();
private userResource = inject(ActivatedRoute).resources?.['user'];
refreshUser() {
// Reloads only this specific resource without renavigating the route
this.userResource?.reload();
}
}However, the typing exposed for resources on activated routes (type ResourceResult = Record<string, Resource<unknown>>) works such that you have to cast the resources[string] for activated route access to consumers from Resource to ResourceRef
export class UserProfile
user = input.required<User>();
private userResource = inject(ActivatedRoute).resources?.['user'];
refreshUser() {
// Reloads only this specific resource without renavigating the route
(this.userResource as ResourceRef<unknown> | undefined)?.reload();
}
}I cannot tell if this is a docs issue or a code type issue. Perhaps it is the later? It seems that internally from what I see in the tests and some of the router resource code, that the inner functionality and test utils are derived from export function routerResource<T>(source: Resource<T>): Resource<T> & {reload(): boolean}. I would assume then that the ActivatedRoute typing for resources would be be type ResourceResult = Record<string, Resource<unknown> & {reload(): boolean}>.
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/stackblitz-starters-wvxzxeg9?file=src%2Fcomponents.ts
Please provide the exception or error you saw
Property 'reload' does not exist on type 'Resource<unknown>'.(2339)
Please provide the environment you discovered this bug in (run ng version)
Angular CLI : 22.2.0-next.6
Angular : 22.2.0-next.7
Node.js : 22.22.3
Package Manager : npm 10.8.2
Operating System : linux x64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 22.2.0-next.6 │ ^22.2.0-next.6 │
│ @angular/cli │ 22.2.0-next.6 │ ^22.2.0-next.6 │
│ @angular/common │ 22.2.0-next.7 │ ^22.2.0-next.7 │
│ @angular/compiler │ 22.2.0-next.7 │ ^22.2.0-next.7 │
│ @angular/compiler-cli │ 22.2.0-next.7 │ ^22.2.0-next.7 │
│ @angular/core │ 22.2.0-next.7 │ ^22.2.0-next.7 │
│ @angular/forms │ 22.2.0-next.7 │ ^22.2.0-next.7 │
│ @angular/platform-browser │ 22.2.0-next.7 │ ^22.2.0-next.7 │
│ @angular/router │ 22.2.0-next.7 │ ^22.2.0-next.7 │
│ rxjs │ 7.8.2 │ ^7.8.1 │
│ typescript │ 6.0.3 │ ^6.0.3 │
Anything else?
@atscott I saw you have some active drafts and an open PR for changes going into router resources, but as of writing out this issue, I didn't see a docs change or type change that addressed this.
PS this stuff is really cool, thank you for router resources.
Activity
atscott commentedon Sep 11, 2026
Thanks for the feedback. I'll see what I can do here. I really wish
reloadwas part of the baseResourceinterface and not just writable resource...fix(router): expose reload method on ActivatedRoute resources
fix(router): expose reload method on ActivatedRoute resources
fix(router): expose reload method on ActivatedRoute resources
fix(router): expose reload method on ActivatedRoute resources
fix(router): expose reload method on ActivatedRoute resources