Skip to content
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

rate-limit-controller: Replace use of any with proper types (non-test files only) #3729

Closed
Tracked by #3706
mcmire opened this issue Jan 4, 2024 · 0 comments · Fixed by #3963
Closed
Tracked by #3706

rate-limit-controller: Replace use of any with proper types (non-test files only) #3729

mcmire opened this issue Jan 4, 2024 · 0 comments · Fixed by #3963
Assignees

Comments

@mcmire
Copy link
Contributor

mcmire commented Jan 4, 2024

No description provided.

@MajorLift MajorLift self-assigned this Feb 22, 2024
MajorLift added a commit that referenced this issue Mar 7, 2024
…3963)

## Explanation

- Fix all `any` usage and more typing fixes and improvements.
- Define `RateLimitedApiMap`, `RateLimitedRequests` for readability and
clarity.
- Rename types (this can be reverted if it's disruptive to any
downstream package):
  - `GetRateLimitState` -> `RateLimitControllerGetStateAction`.
  - `RateLimitStateChange` -> `RateLimitControllerStateChangeEvent`.
  - `CallApi` -> `RateLimitControllerCallApiAction`.

## References

- Closes #3729 

## Changelog

### `@metamask/rate-limit-controller`

### Added

- Add and export types `RateLimitedApiMap`, `RateLimitedRequests`.
([#3963](#3963))
- `RateLimitedApiMap` represents the type of the `RateLimitedApis`
generic parameter used throughout the controller.
- `RateLimitedRequests` represents the type of the `request` property of
`RateLimitState`.

### Changed

- **BREAKING:** Rename types to align with conventions followed by other
controllers. ([#3963](#3963))
  - `GetRateLimitState` is now `RateLimitControllerGetStateAction`.
  - `RateLimitStateChange` is now `RateLimitControllerStateChangeEvent`.
  - `CallApi` is now `RateLimitControllerCallApiAction`.
- Add `@metamask/utils` `^8.3.0` as a dependency.
([#3963](#3963))

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've highlighted breaking changes using the "BREAKING" category
above as appropriate

---------

Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants