Skip to content

0.2.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@LayZeeDK LayZeeDK released this 24 Oct 00:52
· 94 commits to main since this release
f561e15

Features

  • Remove type parameter from selectQueryParam
  • Specify observable type returned from selectQueryParam
  • Remove type parameter from selectRouteParam
  • Specify observable type returned from selectRouteParam

Bug fixes

  • Fixes #272 by building the package using Angular 14. Standalone components and applications are now fully supported, including in component tests.

BREAKING CHANGES

Compatibility

To fully support standalone Angular applications and components, we now require at least the following peer dependencies.

  • Require Angular 14.0
  • Require @ngrx/component-store 14.0
  • Require RxJS 7.4
  • Require TypeScript 4.6

Stricter signature for selectQueryParam

Signature before:

selectQueryParam<TValue>(param: string): Observable<TValue>;

Signature after:

selectQueryParam(param: string): Observable<string | undefined>;
Migration

Loose types now yield compilation errors. Remove the type parameter to use the
actual emitted type of string | undefined and optionally use operators to
change or narrow the type.

Before:

// Actual emitted values are of type `string | undefined` regardless of what we specify
const filter$ = routerStore.selectQueryParam<string | null>('filter');

After:

// Emitted values are implicitly of type `string | undefined` and are only changeable through operators
const filter$ = routerStore
  .selectQueryParam('filter')
  .pipe(map((filter) => filter ?? null));

Stricter signature for selectRouteParam

Signature before:

selectRouteParam<TValue>(param: string): Observable<TValue>;

Signature after:

selectRouteParam(param: string): Observable<string | undefined>;
Migration

Loose types now yield compilation errors. Remove the type parameter to use the
actual emitted type of string | undefined and optionally use operators to
change or narrow the type.

Before:

// Actual emitted values are of type `string | undefined` regardless of what we specify
const id$ = routerStore.selectRouteParam<number>('id');

After:

// Emitted values are implicitly of type `string | undefined` and are only changeable through operators
const id$ = routerStore.selectRouteParam('id').pipe(
  map(id => id === undefined ? undefined : Number(id),
);