Skip to content

Commit 6ab2e37

Browse files
committed
Change the types for BaseControllerV1 class fields initialConfig, initialState from C, S to Partial<C>, Partial<S>
1 parent 0bd4386 commit 6ab2e37

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/base-controller/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Changed
1111

12-
- **BREAKING:** Convert `BaseConfig`, `BaseState` interfaces to types.
12+
- **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))
13+
- **BREAKING:** Convert `BaseConfig`, `BaseState` interfaces to types ([#3959](https://github.com/MetaMask/core/pull/3959))
1314
- As types, `BaseConfig`, `BaseState` now extend `Record` and have an index signature of `string`.
1415

1516
## [4.1.1]

packages/base-controller/src/BaseControllerV1.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ export class BaseControllerV1<C extends BaseConfig, S extends BaseState> {
5353
*/
5454
name = 'BaseController';
5555

56-
private readonly initialConfig: C;
56+
private readonly initialConfig: Partial<C>;
5757

58-
private readonly initialState: S;
58+
private readonly initialState: Partial<S>;
5959

6060
private internalConfig: C = this.defaultConfig;
6161

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

7878
/**

0 commit comments

Comments
 (0)