Skip to content
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

chore: restructuring util/util.ts (part 1) #5431

Merged
merged 4 commits into from
Nov 17, 2023

Conversation

vvagaytsev
Copy link
Collaborator

What this PR does / why we need it:
Currently, the util/util.ts file is a big pile of helper functions of different kinds.

This PR is the first step to decompose that utility module into smaller, semantically-scoped groups of helpers.

That decomposition will help to navigate the codebase more easily and allow us to deduplicate some helper functions and interfaces, making them more generic and unified.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

@vvagaytsev vvagaytsev requested a review from a team November 17, 2023 11:10
@vvagaytsev vvagaytsev enabled auto-merge November 17, 2023 11:42
@@ -85,6 +83,10 @@ export type Unpacked<T> = T extends (infer U)[]
export type ExcludesFalsy = <T>(x: T | false | null | undefined) => x is T
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>

export interface Dictionary<T> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a refactoring so definitely not a blocker, but I guess we could replace that with Record<string, T>?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Maybe, this type was introduced as a short-handed type for string-keyed Record. In that case, we can just re-declare it as type Dictionary<T> = Record<string, T>

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be addressed in the next PR, there will be a series of PRs to refactor util/util.ts :)

@vvagaytsev vvagaytsev added this pull request to the merge queue Nov 17, 2023
Merged via the queue into main with commit c67f242 Nov 17, 2023
3 checks passed
@vvagaytsev vvagaytsev deleted the refactor/util-refactoring-1 branch November 17, 2023 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants