Commit 22b9f36
committed
feat!: use immutable route data
**BREAKING CHANGES**
`StrictRouteData`
members are now read-only.
TypeScript will fail to compile application code that mutates route data data structures.
BEFORE:
```typescript
// heroes.component.ts
// (...)
import { RouterStore } from "@ngworker/router-component-store";
@component({
// (...)
})
export class DashboardComponent {
#routerStore = inject(RouterStore);
limit$: Observable<number> = this.#routerStore. routeData$.pipe(
map((data) => {
data["limit"] = Number(data["limit"])
return data;
}),
map(data => data["limit"])
);
}
```
AFTER:
```typescript
// heroes.component.ts
// (...)
import { RouterStore } from "@ngworker/router-component-store";
@component({
// (...)
})
export class DashboardComponent {
#routerStore = inject(RouterStore);
limit$: Observable<number> = this.#routerStore.routeData$.pipe(
map((data) => Number(data["limit"]))
);
}
```1 parent 70a2c0f commit 22b9f36
2 files changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
0 commit comments