Last active
September 8, 2023 01:39
-
-
Save edezekiel/eb7f211bb8f583ba5078fe35737d8e26 to your computer and use it in GitHub Desktop.
Manually define a type signature on an interface
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 Hero { | |
name: string, | |
[key: string]: string // Manually add index signature | |
} | |
const hero: Hero = { name: 'codey' } | |
const generic: Record<string, unknown> = hero; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment