Skip to content

Instantly share code, notes, and snippets.

@adrian-afergon
Created April 11, 2019 20:17
Show Gist options
  • Save adrian-afergon/4a532c0524a1c0897f056614e52157d3 to your computer and use it in GitHub Desktop.
Save adrian-afergon/4a532c0524a1c0897f056614e52157d3 to your computer and use it in GitHub Desktop.
export const createAnExercise = ({
warning = 'irrelevant warning message',
tags = [] as string[],
name = 'irrelevant name',
image = 'irrelevant image url'
// ... at less 20 props
} as Exercise): Exercise => ({
warning,
tags,
name,
image,
// ... at less 20 props
});
// const aExercise = createAnExercise({}); // it will return the default values
// const aExercise = createAnExercise({warning: 'This is a warning message'}); // it will return the default values, but setting the param value for warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment