-
-
Save jrson83/8032a62dda987057a267d2ee5bbd7fe8 to your computer and use it in GitHub Desktop.
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
interface Messenger { | |
sendText: () => void; | |
sendFile: () => void; | |
checkStatus?: () => void; | |
} | |
type RequiredFields<T> = { | |
[K in keyof T as T[K] extends Required<T>[K] ? K : never]: T[K]; | |
}; | |
// type RequiredMessengerProperties = { | |
// sendText: () => void; | |
// sendFile: () => void; | |
// } | |
type RequiredMessengerProperties = RequiredFields<Messenger>; | |
type FeatureOptions<T> = { | |
[K in keyof T as `is${Capitalize<K & string>}Enabled`]: boolean; | |
}; | |
// type FeatureFlags = { | |
// isSendTextEnabled: boolean; | |
// isSendFileEnabled: boolean; | |
// } | |
type FeatureFlags = FeatureOptions<RequiredMessengerProperties>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment