Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

how to pass function as a optional props in typescript type

interface Props {
  type: 'goal' | 'course'
  onSaveCourse?: (title: string, date: Date) => void
  onSaveGoal?: (text: string) => void
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pass #function #optional #props #typescript #type
ADD COMMENT
Topic
Name
7+1 =