mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 02:33:46 +00:00
We currently use a callback syntax for abstract services. This syntax isn't completely strict compliant and will fail the strictPropertyInitialization check. We also currently don't get any compile time errors if we forget to implement a function. To that end this PR updates all platform owned services to use the appropriate abstract keyword for non implemented functions. I also updated the fields to be actual functions and not properties.
26 lines
980 B
TypeScript
26 lines
980 B
TypeScript
import { Observable } from "rxjs";
|
|
|
|
import { DerivedStateDependencies } from "../../types/state";
|
|
|
|
import { DeriveDefinition } from "./derive-definition";
|
|
import { DerivedState } from "./derived-state";
|
|
|
|
/**
|
|
* State derived from an observable and a derive function
|
|
*/
|
|
export abstract class DerivedStateProvider {
|
|
/**
|
|
* Creates a derived state observable from a parent state observable, a deriveDefinition, and the dependencies
|
|
* required by the deriveDefinition
|
|
* @param parentState$ The parent state observable
|
|
* @param deriveDefinition The deriveDefinition that defines conversion from the parent state to the derived state as
|
|
* well as some memory persistent information.
|
|
* @param dependencies The dependencies of the derive function
|
|
*/
|
|
abstract get<TFrom, TTo, TDeps extends DerivedStateDependencies>(
|
|
parentState$: Observable<TFrom>,
|
|
deriveDefinition: DeriveDefinition<TFrom, TTo, TDeps>,
|
|
dependencies: TDeps,
|
|
): DerivedState<TTo>;
|
|
}
|