Created
May 3, 2018 00:42
-
-
Save Devcon4/37f263ad6bcf8f423caf94ad2b79ae6a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 FunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? K : never }[keyof T]; | |
| type rule<T> = {[key in FunctionPropertyNames<T>]?: T[key] extends (args: infer U) => void ? U : never}; | |
| | |
| class rules { | |
| ruleOne(args: {first: string, second: number}) { } | |
| } | |
| | |
| function ruleTwo(args: {first: number}) { } | |
| | |
| let test: rule<rules & {ruleTwo: typeof ruleTwo}> = { | |
| ruleOne: { first: '', second: 3 }, | |
| ruleTwo: { first: 2 } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment