Memoize functions - an optimization technique used to speed up consecutive function calls by caching the result of calls with identical input
by sindresorhusTypeScript
Last 12 weeks · 0 commits
4 of 6 standards met
While this reads fine: This is bad practice: This could be enforced by a linter, since APIs like exist natively, but ideally and should accept a single parameter: It complicates types a bit but it requires the much cleaner: _Personal note:_ I went through this recently in webext-storage-cache, changing to
TypeScript users need to manually copy internal type definitions to create custom caches because and are not exported. Changes index.ts: Export and types test-d/index.test-d.ts: Add type tests verifying exported types work with custom cache implementations Usage Original prompt This section details on the original issue you should resolve* Defining custom cache in TypeScript Neither , nor are exported. So, in order to define a custom cache, I have to manually copy the types: or, a bit nicer: Could we have some exported types? ## Comments on the Issue (you are @copilot in this section) Fixes sindresorhus/memoize#111 💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
Repository: sindresorhus/memoize. Description: Memoize functions - an optimization technique used to speed up consecutive function calls by caching the result of calls with identical input Stars: 1160, Forks: 54. Primary language: TypeScript. Languages: TypeScript (100%). License: MIT. Latest release: v11.0.0 (3mo ago). Open PRs: 0, open issues: 1. Last activity: 3mo ago. Community health: 85%. Top contributors: sindresorhus, fregante, SamVerschueren, Richienb, BendingBender, bencehornak, coreyfarrell, dylang, elvinn, keithamus and others.