Created
September 1, 2019 13:14
-
-
Save mathieu-anderson/79a058aebc52d92b87a97bccdb8d9b10 to your computer and use it in GitHub Desktop.
Defining an interface
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
// Defining an interface | |
type InputValue = string | number; | |
type Label = string; | |
interface InputProps { | |
value: InputValue; | |
label: Label; | |
} | |
function InterfaceTsInput(props: InputProps) { | |
const { value, label } = props; | |
return ( | |
<div className="container"> | |
<div className="label">{label}</div> | |
<div className="typeof"> | |
Type: <b>{typeof value}</b> | |
</div> | |
<input value={value} /> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment