Brand memoized args from React.useMemo
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.5k
- Forks
- 5.4k
- PR merge metrics
- No merged PRs in 30d
Description
Is your feature request related to a problem? Please describe.
Certain functions, like multicall, will only be performant when memoized. This can currently only be caught in code reviews (eg #2806).
Describe the solution you'd like
useMemo should be retyped to return a branded type, and useSingleCallResult should enforce (via typing) that passed arguments are memoized.
Describe alternatives you've considered
N/A
Additional context
Example tutorial of branding (like branding a cow, not like a company's brand): https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the React.useMemo usage and the useSingleCallResult hook, then inspect their existing TypeScript declarations and call sites. The work is done when memoized values carry a branded type and useSingleCallResult rejects non-memoized arguments through type checking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100