Skip to content

Instantly share code, notes, and snippets.

@ehatricksmith
Created May 31, 2022 05:21
Show Gist options
  • Save ehatricksmith/21e5412de1897205b059d611b134f249 to your computer and use it in GitHub Desktop.
Save ehatricksmith/21e5412de1897205b059d611b134f249 to your computer and use it in GitHub Desktop.
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