Last active
February 5, 2024 12:41
-
-
Save turbod/4043ca16af9045dec94f6e6364ecef3f 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
type Events = { | |
add: string; | |
remove: string; | |
move: string; | |
}; | |
type EventKeys = keyof Events; | |
const userActions: OnEvent = { | |
onAdd: () => {}, | |
onRemove: () => {}, | |
onMove: () => {}, | |
}; | |
type OnEvent = { | |
[Key in EventKeys as `on${Capitalize<Key>}`]: () => any | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment