Skip to content

Commit

Permalink
Apply ts-expect-error to flaky immer type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MajorLift committed Aug 2, 2024
1 parent c19b225 commit f8b78d5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions packages/accounts-controller/src/AccountsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,7 @@ export class AccountsController extends BaseController<
metadata: { ...account.metadata, ...metadata },
};
// Do not remove this comment - This error is flaky: Comment out or restore the `ts-expect-error` directive below as needed.
// See: https://github.com/MetaMask/utils/issues/168
// // @ts-expect-error Known issue - `Json` causes recursive error in immer `Draft`/`WritableDraft` types
// // @ts-expect-error - Known issue: `Json` causes recursive error in immer `Draft`/`WritableDraft` types (See: https://github.com/MetaMask/utils/issues/168)
currentState.internalAccounts.accounts[accountId] = internalAccount;
});
}
Expand Down
2 changes: 2 additions & 0 deletions packages/permission-controller/src/PermissionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,8 @@ export class PermissionController<
);

if (caveatIndex === -1) {
// Do not remove this comment - This error is flaky: Comment out or restore the `ts-expect-error` directive below as needed.
// // @ts-expect-error - Known issue: `Json` causes recursive error in immer `Draft`/`WritableDraft` types (See: https://github.com/MetaMask/utils/issues/168)
permission.caveats.push(caveat);
} else {
permission.caveats.splice(caveatIndex, 1, caveat);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ export class SubjectMetadataController extends BaseController<
*/
trimMetadataState(): void {
this.update((draftState) => {
// @ts-expect-error ts(2589)
// Do not remove this comment - This error is flaky: Comment out or restore the `ts-expect-error` directive below as needed.
// @ts-expect-error - Known issue: `Json` causes recursive error in immer `Draft`/`WritableDraft` types (See: https://github.com/MetaMask/utils/issues/168)
return SubjectMetadataController.getTrimmedState(
draftState,
this.subjectHasPermissions,
Expand Down

0 comments on commit f8b78d5

Please sign in to comment.