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

Improve the type-utils package, split code, add some comments and examples #15743

Merged
merged 4 commits into from
Dec 3, 2024

Conversation

peter-sanderson
Copy link
Contributor

No description provided.

@@ -13,9 +14,6 @@ import type { ElectrumClient } from './client/electrum';
type BlockListener = ReturnType<typeof L.blockListener>;
type TxListener = ReturnType<typeof L.txListener>;

// reason:
// https://stackoverflow.com/questions/57103834/typescript-omit-a-property-from-all-interfaces-in-a-union-but-keep-the-union-s#answer-57103940
type Without<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is exactly same as here.

@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-use-before-define */
// code shamelessly stolen from https://github.com/voodoocreation/ts-deepmerge

type TAllKeys<T> = T extends any ? keyof T : never;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as here

export type ItemExtractor<M> = Extract<M, { type: M }>;

// Unwrap type from Promise
export type Await<T> = T extends {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unused

@@ -30,757 +65,46 @@ export type ConstWithOptionalFields<
};
};

// Extract item from union
export type ItemExtractor<M> = Extract<M, { type: M }>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unused

Copy link
Contributor

@Lemonexe Lemonexe left a comment

Choose a reason for hiding this comment

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

👏

@peter-sanderson peter-sanderson enabled auto-merge (rebase) December 3, 2024 15:34
@peter-sanderson peter-sanderson merged commit ff38635 into develop Dec 3, 2024
36 checks passed
@peter-sanderson peter-sanderson deleted the split-type-utils branch December 3, 2024 15:37
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.

3 participants