Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface Animal {
- id: string;
- name: string;
- type: 'cat' | 'dog' | 'snake' | 'monkey';
- }
- const dog: Animal = { id: 'dog-id', name: 'Larry', type: 'dog' };
- if (dog.type === 'dog') {
- console.log('Woof woof');
- }
Add Comment
Please, Sign In to add comment