|
1 | 1 | # Router Component Store changelog
|
2 | 2 |
|
| 3 | +## 0.2.0 (2022-10-24) |
| 4 | + |
| 5 | +### Features |
| 6 | + |
| 7 | +- Remove type parameter from `selectQueryParam` |
| 8 | +- Specify observable type returned from `selectQueryParam` |
| 9 | +- Remove type parameter from `selectRouteParam` |
| 10 | +- Specify observable type returned from `selectRouteParam` |
| 11 | + |
| 12 | +### **BREAKING CHANGES** |
| 13 | + |
| 14 | +#### Stricter signature for selectQueryParam |
| 15 | + |
| 16 | +Signature before: |
| 17 | + |
| 18 | +```typescript |
| 19 | +selectQueryParam<TValue>(param: string): Observable<TValue>; |
| 20 | +``` |
| 21 | + |
| 22 | +Signature after: |
| 23 | + |
| 24 | +```typescript |
| 25 | +selectQueryParam(param: string): Observable<string | undefined>; |
| 26 | +``` |
| 27 | + |
| 28 | +##### Migration |
| 29 | + |
| 30 | +Loose types now yield compilation errors. Remove the type parameter to use the |
| 31 | +actual emitted type of `string | undefined` and optionally use operators to |
| 32 | +change or narrow the type. |
| 33 | + |
| 34 | +Before: |
| 35 | + |
| 36 | +```typescript |
| 37 | +// Actual emitted values are of type `string | undefined` regardless of what we specify |
| 38 | +const filter$ = routerStore.selectQueryParam<string | null>('filter'); |
| 39 | +``` |
| 40 | + |
| 41 | +After: |
| 42 | + |
| 43 | +```typescript |
| 44 | +// Emitted values are implicitly of type `string | undefined` and are only changeable through operators |
| 45 | +const filter$ = routerStore |
| 46 | + .selectQueryParam('filter') |
| 47 | + .pipe(map((filter) => filter ?? null)); |
| 48 | +``` |
| 49 | + |
| 50 | +#### Stricter signature for selectRouteParam |
| 51 | + |
| 52 | +Signature before: |
| 53 | + |
| 54 | +```typescript |
| 55 | +selectRouteParam<TValue>(param: string): Observable<TValue>; |
| 56 | +``` |
| 57 | + |
| 58 | +Signature after: |
| 59 | + |
| 60 | +```typescript |
| 61 | +selectRouteParam(param: string): Observable<string | undefined>; |
| 62 | +``` |
| 63 | + |
| 64 | +##### Migration |
| 65 | + |
| 66 | +Loose types now yield compilation errors. Remove the type parameter to use the |
| 67 | +actual emitted type of `string | undefined` and optionally use operators to |
| 68 | +change or narrow the type. |
| 69 | + |
| 70 | +Before: |
| 71 | + |
| 72 | +```typescript |
| 73 | +// Actual emitted values are of type `string | undefined` regardless of what we specify |
| 74 | +const id$ = routerStore.selectRouteParam<number>('id'); |
| 75 | +``` |
| 76 | + |
| 77 | +After: |
| 78 | + |
| 79 | +```typescript |
| 80 | +// Emitted values are implicitly of type `string | undefined` and are only changeable through operators |
| 81 | +const id$ = routerStore.selectRouteParam('id').pipe( |
| 82 | + map(id => id === undefined ? undefined : Number(id), |
| 83 | +); |
| 84 | +``` |
| 85 | +
|
3 | 86 | ## 0.1.1 (2022-10-21)
|
4 | 87 |
|
5 | 88 | ### Features
|
|
0 commit comments