Created
May 30, 2020 19:23
-
-
Save diegogriep/80bf7623a9ba433781126ffbe745b02f to your computer and use it in GitHub Desktop.
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 DriverF1 { | |
firstName: string; | |
lastName: string; | |
} | |
const newDriverF1 = <T extends DriverF1>(obj: T) => { | |
return { | |
...obj, | |
fullName: `${obj.firstName} ${obj.lastName}` | |
} | |
} | |
let hamilton = newDriverF1({ firstName: 'Lewis', lastName: 'Hamilton', team: 'Mercedes' }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment