MetaMask / MetaMask/core

Remove `any` from `PermissionController` types

Open
#4,237 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

team-wallet-framework wf-type-fixes
Dominant language
TypeScript
Stars
413
Forks
308
Avg merge
1d 4h
Merged PRs (30d)
253

Description

Following #4171, `any` is only used in a small number of `PermissionController` types. They are _mostly_, but not always used as constraints. We should eliminate `any` from the following types:
- [ ] `CaveatSpecificationBase`
- [ ] `PermissionSpecificationBase`
- [ ] `RestrictedMethodSpecificationConstraint`
- Will be resolved by #4238

For the `*SpecificationBase` types, I believe the solution is to genericize them such that TypeScript can determine whether a concrete specification is valid. The refactor necessary to accomplish this may not be terrible, but it's not trivial.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the definitions and uses of CaveatSpecificationBase and PermissionSpecificationBase, then compare their constraints with the concrete specifications that consume them. Genericize the base types so TypeScript can validate concrete specifications without any; RestrictedMethodSpecificationConstraint is tracked separately in #4238.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
authorization
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.