Skip to content

Commit

Permalink
Change the types for BaseControllerV1 class fields initialConfig,…
Browse files Browse the repository at this point in the history
… `initialState` from `C`, `S` to `Partial<C>`, `Partial<S>`
  • Loading branch information
MajorLift committed Feb 22, 2024
1 parent 0bd4386 commit 6ab2e37
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/base-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- **BREAKING:** Convert `BaseConfig`, `BaseState` interfaces to types.
- **BREAKING:** Change the types for `BaseControllerV1` class fields `initialConfig`, `initialState` from `C`, `S` to `Partial<C>`, `Partial<S>` ([#3959](https://github.com/MetaMask/core/pull/3959))
- **BREAKING:** Convert `BaseConfig`, `BaseState` interfaces to types ([#3959](https://github.com/MetaMask/core/pull/3959))
- As types, `BaseConfig`, `BaseState` now extend `Record` and have an index signature of `string`.

## [4.1.1]
Expand Down
8 changes: 4 additions & 4 deletions packages/base-controller/src/BaseControllerV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ export class BaseControllerV1<C extends BaseConfig, S extends BaseState> {
*/
name = 'BaseController';

private readonly initialConfig: C;
private readonly initialConfig: Partial<C>;

private readonly initialState: S;
private readonly initialState: Partial<S>;

private internalConfig: C = this.defaultConfig;

Expand All @@ -71,8 +71,8 @@ export class BaseControllerV1<C extends BaseConfig, S extends BaseState> {
* @param state - Initial state to set on this controller.
*/
constructor(config: Partial<C> = {}, state: Partial<S> = {}) {
this.initialState = { ...(state as S) };
this.initialConfig = { ...(config as C) };
this.initialState = { ...state };
this.initialConfig = { ...config };
}

/**
Expand Down

0 comments on commit 6ab2e37

Please sign in to comment.