Skip to content

Instantly share code, notes, and snippets.

View vpalos's full-sized avatar

Valeriu Paloş vpalos

View GitHub Profile
@vpalos
vpalos / enum-keys.ts
Last active February 25, 2020 06:46
How to use `enum` values as strictly typed object keys in TypeScript.
enum DialogButton {
YES = "yes",
NO = "no",
CANCEL = "cancel"
}
interface IDialog {
buttons: { [B in DialogButton]?: boolean },
callback: (button: DialogButton) => void
}