Created
May 31, 2022 05:21
-
-
Save ehatricksmith/21e5412de1897205b059d611b134f249 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 User { | |
id: string; | |
name?: string; | |
address?: string; | |
} | |
interface Node { | |
id: string; | |
x?: number; | |
y?: number; | |
} | |
const user: User = { id: "abcd" }; | |
// This assignment is permitted! | |
// The object matches the structure of both interfaces. | |
const node: Node = user; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment