@ngrx/component-store
Advanced tools
Comparing version 16.0.0-beta.0 to 16.0.0-rc.0
{ | ||
"name": "@ngrx/component-store", | ||
"version": "16.0.0-beta.0", | ||
"version": "16.0.0-rc.0", | ||
"description": "Reactive store for component state", | ||
@@ -25,3 +25,3 @@ "repository": { | ||
"peerDependencies": { | ||
"@angular/core": "^16.0.0-next.0", | ||
"@angular/core": "^16.0.0", | ||
"rxjs": "^6.5.3 || ^7.5.0" | ||
@@ -28,0 +28,0 @@ }, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.platformVersion = void 0; | ||
exports.platformVersion = '^16.0.0-beta.0'; | ||
exports.platformVersion = '^16.0.0-rc.0'; | ||
//# sourceMappingURL=libs-version.js.map |
import { Observable, Subscription, ObservedValueOf } from 'rxjs'; | ||
import { OnDestroy, InjectionToken, Signal } from '@angular/core'; | ||
import { OnDestroy, InjectionToken, Signal, type ValueEqualityFn } from '@angular/core'; | ||
import * as i0 from "@angular/core"; | ||
@@ -12,2 +12,11 @@ export interface SelectConfig { | ||
export type Projector<Selectors extends Observable<unknown>[], Result> = (...args: SelectorResults<Selectors>) => Result; | ||
type SignalsProjector<Signals extends Signal<unknown>[], Result> = (...values: { | ||
[Key in keyof Signals]: Signals[Key] extends Signal<infer Value> ? Value : never; | ||
}) => Result; | ||
interface SelectSignalOptions<T> { | ||
/** | ||
* A comparison function which defines equality for select results. | ||
*/ | ||
equal?: ValueEqualityFn<T>; | ||
} | ||
export declare class ComponentStore<T extends object> implements OnDestroy { | ||
@@ -19,4 +28,4 @@ private readonly destroySubject$; | ||
readonly state$: Observable<T>; | ||
readonly state: Signal<T>; | ||
private ɵhasProvider; | ||
readonly state: Signal<T>; | ||
constructor(defaultState?: T); | ||
@@ -85,8 +94,18 @@ /** Completes all relevant Observable streams. */ | ||
/** | ||
* Returns a signal of the provided projector function. | ||
* | ||
* @param projector projector function | ||
* Creates a signal from the provided state projector function. | ||
*/ | ||
selectSignal<K>(projector: (state: T) => K): Signal<K>; | ||
selectSignal<Result>(projector: (state: T) => Result, options?: SelectSignalOptions<Result>): Signal<Result>; | ||
/** | ||
* Creates a signal by combining provided signals. | ||
*/ | ||
selectSignal<Signals extends Signal<unknown>[], Result>(...args: [...signals: Signals, projector: SignalsProjector<Signals, Result>]): Signal<Result>; | ||
/** | ||
* Creates a signal by combining provided signals. | ||
*/ | ||
selectSignal<Signals extends Signal<unknown>[], Result>(...args: [ | ||
...signals: Signals, | ||
projector: SignalsProjector<Signals, Result>, | ||
options: SelectSignalOptions<Result> | ||
]): Signal<Result>; | ||
/** | ||
* Creates an effect. | ||
@@ -110,1 +129,2 @@ * | ||
} | ||
export {}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
346009
56
3187