Last active
March 11, 2022 10:17
-
-
Save kaczor6418/88a32b7e772751734b057f601ae35272 to your computer and use it in GitHub Desktop.
Tyoe for manual calss mocks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type FunctionReturnTypes<T> = { | |
[K in keyof T as T[K] extends Function ? K : never]: | |
T[K] extends (...args: any) => infer R ? R : never | |
}; | |
type ClassFieldsTypes<T> = { | |
[K in keyof T]: T[K] | |
} | |
type ManualClassMock<T> = Partial<FunctionReturnTypes<T>> | Partial<ClassFieldsTypes<T>>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment