-
-
Notifications
You must be signed in to change notification settings - Fork 283
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
fix: improve perf #764
fix: improve perf #764
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #764 +/- ##
==========================================
- Coverage 90.75% 90.55% -0.21%
==========================================
Files 2 2
Lines 422 413 -9
Branches 121 120 -1
==========================================
- Hits 383 374 -9
Misses 38 38
Partials 1 1 ☔ View full report in Codecov by Sentry. |
@@ -39,9 +39,3 @@ export function throttleAll<T>(limit: number, tasks: Task<T>[]): Promise<T[]>; | |||
* @returns {function(): T} | |||
*/ | |||
export function memoize<T>(fn: (() => any) | undefined): () => T; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know anything about the packae and these things, so please tell me if I'm off :)
I find it strange and not type-sae at all that the function we pass returns any
. Also I doubt we can pass undefined as a function because it's called directly...
So shouldn't the type be more something like:
export function memoize<T>(fn: () => T): () => T;
Maybe you wanted undefined
because of the line fn = undefined;
in the function. It might be better (for types) to keep fn
in a separate variable that can be undefined
, so that the parameter itself can't be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, yeah, if you want improve types here - feel free to send a PR
This PR contains a:
Motivation / Use-Case
#763 and improve tooling
Breaking Changes
No
Additional Info
No