-
-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(permission-controller): Clean up use of any
#4171
Merged
Merged
Changes from 2 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
0196028
refactor(permission-controller): Refactor "any" typecasts
rekmarks 632ebc9
fix(accounts-controller): Remove suddenly and mysteriously extraneous…
rekmarks 6b95853
refactor(permission-controller): Simplify switch in updatePermissions…
rekmarks f4cd213
refactor(permission-controller): Replace `any` types in Caveat.test.ts
rekmarks a16abf9
refactor(permission-controller): Add specific types in getPermissions…
rekmarks e620020
Merge branch 'main' into rekmarks-permission-controller-cleanup
rekmarks c54671b
refactor(acounts-controller): Remove ts-expect-error entirely
rekmarks ab7031b
fix: Apply suggestions to Caveat.ts
rekmarks 26e48f1
fix: Apply suggestions to Permission.ts
rekmarks 49d833c
fix: PermissionController.removeCaveat() type
rekmarks 376d8f8
refactor: Replace ts-expect-error directives in tests where possible
rekmarks 6f8fa3d
fix: Apply suggestions to permission controller and its tests
rekmarks b7a275f
fix: Replace all uses of any in permission controller tests
rekmarks a6b7101
Merge branch 'main' into rekmarks-permission-controller-cleanup
rekmarks ee2ad01
fix: Remove unnecessary any from constraint type
rekmarks 834d764
refactor: Replace type casts with type assertions
rekmarks 1a948c5
Merge branch 'main' into rekmarks-permission-controller-cleanup
rekmarks 1a53dab
Merge branch 'main' into rekmarks-permission-controller-cleanup
rekmarks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rekmarks marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rekmarks marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So why was this breaking things if it wasn't before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have absolutely no idea and I'm scared to find out. Although, it's technically not breaking something now, where it was broken before. Maybe some kind of interaction with the
PermissionController
types mediated by Snaps-related imports? That's the only thing I can think of.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This upstream bug currently affects
Draft<T>
types andupdate()
calls in our codebase.There's not much we can do about it on our end other than add (or remove)
@ts-expect-error
annotations whenever the compiler breaks out with an "excessive type instantiation depth" error.For
update()
calls, returning a new state instead of mutating in place can sometimes help.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are your thoughts on keeping this comment in place and removing the type assertion instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whatever TS version and config my VS Code is using is unhappy about this, but removing both the cast and the
ts-expect-error
seems to work: c54671b