Skip to content

Instantly share code, notes, and snippets.

@turbod
Last active February 5, 2024 12:41
Show Gist options
  • Save turbod/4043ca16af9045dec94f6e6364ecef3f to your computer and use it in GitHub Desktop.
Save turbod/4043ca16af9045dec94f6e6364ecef3f to your computer and use it in GitHub Desktop.
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