Skip to content

Instantly share code, notes, and snippets.

@LFSCamargo
Last active February 6, 2019 21:05
Show Gist options
  • Save LFSCamargo/9d2ffb76d7c05989c3edd900fb9b484f to your computer and use it in GitHub Desktop.
Save LFSCamargo/9d2ffb76d7c05989c3edd900fb9b484f to your computer and use it in GitHub Desktop.
Interface composition example
interface User {
username: string;
email: string;
password: string;
}
// So here we cant user the & operator after extends to compose types
// So if you want to extend more than one interface or type you need to use type
interface Compose extends User {
example: Object;
users: User[];
}
/**
How this will look like on the end:
{
example: {},
username: 'foo',
email: '[email protected]',
password: '123',
users: [...],
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment