Skip to content

Commit f347aa0

Browse files
committed
refactor(accounts-controller): use type-cast instead of @ts-expect-error
1 parent aa7690c commit f347aa0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/accounts-controller/src/AccountsController.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,12 @@ export class AccountsController extends BaseController<
466466
};
467467

468468
this.update((state) => {
469-
// FIXME: Do not remove this comment - This error is flaky: Comment out or restore the `ts-expect-error` directive below as needed.
470-
// See: https://github.com/MetaMask/utils/issues/168
471-
// // @ts-expect-error Known issue - `Json` causes recursive error in immer `Draft`/`WritableDraft` types
472-
state.internalAccounts.accounts[accountId] = internalAccount;
469+
// FIXME: Using the state as-is cause the following error: "Type instantiation is excessively
470+
// deep and possibly infinite.ts(2589)" (https://github.com/MetaMask/utils/issues/168)
471+
// Using a type-cast workaround this error and is slightly better than using a @ts-expect-error
472+
// which sometimes fail when compiling locally.
473+
(state as AccountsControllerState).internalAccounts.accounts[accountId] =
474+
internalAccount;
473475
});
474476

475477
if (metadata.name) {

0 commit comments

Comments
 (0)