Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

typescript union types

type Cow = {
  name: string;
  moo: () => void;
};

type Dog = {
  name: string;
  bark: () => void;
};

type Cat = {
  name: string;
  meow: () => void;
};

// union type
type Animals = Cow | Dog | Cat;
  
 
PREVIOUS NEXT
Tagged: #typescript #union #types
ADD COMMENT
Topic
Name
8+1 =