Last active
August 9, 2020 13:06
-
-
Save jaycosaur/eec10a30241ecedbf9f01b3dee40a203 to your computer and use it in GitHub Desktop.
Implicit vs Explicit typing [typescript] - Typescript to Python field guide
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
interface Person { | |
name: string; | |
age: number; | |
height: number; | |
friends: Person[]; | |
} | |
// Jane implicitly implements the person type | |
const jane = { | |
name: "Jane", | |
age: 25, | |
height: 1.74, | |
friends: [], | |
}; | |
// Tim implicitly implements the person type | |
const tim: Person = { | |
name: "Tim", | |
age: 23, | |
height: 1.71, | |
friends: [jane], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment