xxxxxxxxxx
type EmployeeProps = {
name: string;
age: number;
country: string;
}
xxxxxxxxxx
function App() {
return (<div>
<Employee name="Alison" age={36} country="Germany" />
</div>
);
}
export default App;
interface EmployeeProps {
name: string;
age: number;
country: string;
}
function Employee({name, age, country}: EmployeeProps) {
return (
<div>
<h2>{name}</h2>
<h2>{age}</h2>
<h2>{country}</h2>
</div>
);
}
/*changing type of name to number without changing the string will result in an error Type 'string' is not assignable to type 'number'.*/