Created
April 24, 2020 16:22
-
-
Save jamesseanwright/705a8f7fa803fa5a04d79569891a4ae9 to your computer and use it in GitHub Desktop.
Creating TypeScript object types with mapped types
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 LogLevel = | |
| | 'debug' | |
| | 'info' | |
| | 'warning' | |
| | 'error'; | |
| type Logger = { | |
| [Level in LogLevel]: (...args: unknown[]) => void; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment