formatjs icon indicating copy to clipboard operation
formatjs copied to clipboard

Unnecessary `any` type in `@formatjs/fast-memoize`

Open SimpleCreations opened this issue 5 months ago • 2 comments

Hey 👋 First of all, I know that the @formatjs/fast-memoize fork is for internal use. But it's I found it quite convenient to use in userland, because it saves a few KBs of bundle size on installing a 2nd copy of fast-memoize.

Which package?

@formatjs/fast-memoize

Describe the bug

This line: https://github.com/formatjs/formatjs/blob/783243afe8e45c31fca6a1b227466b5b24424854/packages/fast-memoize/index.ts#L40

adds unnecessary (arg: any) => any to the return type. This makes the memoize functional unusable in a strictly type checked environment (e.g. where @typescript-eslint.io/no-unsafe-return is applied).

To Reproduce

Codesandbox URL

N/A

Reproducible Steps/Repo

N/A

Expected behavior

(arg: any) => any is not present in the return type of memoize

Screenshots

N/A

Desktop (please complete the following information):

N/A

Smartphone (please complete the following information):

N/A

Additional context

SimpleCreations avatar Jun 30 '25 15:06 SimpleCreations

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jul 31 '25 02:07 github-actions[bot]

I'll look into opening a PR

SimpleCreations avatar Jul 31 '25 07:07 SimpleCreations