1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

Fixup usages of initializeAs

This commit is contained in:
Matt Gibson
2022-11-21 09:44:37 -05:00
parent 9b3b389a6f
commit 958b5daf1d
3 changed files with 4 additions and 4 deletions

View File

@@ -21,10 +21,10 @@ class BuildOptions<T, TJson = Jsonify<T>> {
* @param buildOptions * @param buildOptions
* Builders for the value, requires either a constructor (ctor) for your BehaviorSubject type or an * Builders for the value, requires either a constructor (ctor) for your BehaviorSubject type or an
* initializer function that takes a key value pair representation of the BehaviorSubject data * initializer function that takes a key value pair representation of the BehaviorSubject data
* and returns your instantiated BehaviorSubject value. `initializeAsArray can optionally be used to indicate * and returns your instantiated BehaviorSubject value. `initializeAs can optionally be used to indicate
* the provided initializer function should be used to build an array of values. For example, * the provided initializer function should be used to build an array of values. For example,
* ```ts * ```ts
* \@sessionSync({ initializer: Foo.fromJSON, initializeAsArray: true }) * \@sessionSync({ initializer: Foo.fromJSON, initializeAs: 'array' })
* ``` * ```
* is equivalent to * is equivalent to
* ``` * ```

View File

@@ -10,7 +10,7 @@ import { BrowserStateService } from "./abstractions/browser-state.service";
@browserSession @browserSession
export class BrowserPolicyService extends PolicyService { export class BrowserPolicyService extends PolicyService {
@sessionSync({ ctor: Policy, initializeAsArray: true }) @sessionSync({ ctor: Policy, initializeAs: "array" })
protected _policies: BehaviorSubject<Policy[]>; protected _policies: BehaviorSubject<Policy[]>;
constructor(stateService: BrowserStateService, organizationService: OrganizationService) { constructor(stateService: BrowserStateService, organizationService: OrganizationService) {

View File

@@ -21,7 +21,7 @@ export class BrowserStateService
{ {
@sessionSync({ @sessionSync({
initializer: Account.fromJSON as any, // TODO: Remove this any when all any types are removed from Account initializer: Account.fromJSON as any, // TODO: Remove this any when all any types are removed from Account
initializeAsRecord: true, initializeAs: "record",
}) })
protected accountsSubject: BehaviorSubject<{ [userId: string]: Account }>; protected accountsSubject: BehaviorSubject<{ [userId: string]: Account }>;
@sessionSync({ ctor: String }) @sessionSync({ ctor: String })