Last active
March 1, 2019 22:28
-
-
Save ratbeard/c6d6c307008028bfdf5a0bccc3c1674b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
griz asks: | |
something I didn't get | |
question isn't in the object passed in, and the order of the args doesn't match | |
seems like that'd be a type error? | |
*/ | |
export function MatchingQuestion({ onSelectChoice, onBreakMatch, questionState }: { | |
question: MatchingQuestionUI; | |
questionState: MatchingQuestionState; | |
onSelectChoice: (choice: MatchingChoice) => void; | |
onBreakMatch: (choice: MatchingChoice) => void; | |
}) { | |
// Equiv to => | |
interface Argz { | |
question: MatchingQuestionUI; | |
questionState: MatchingQuestionState; | |
onSelectChoice: (choice: MatchingChoice) => void; | |
onBreakMatch: (choice: MatchingChoice) => void; | |
} | |
export function MatchingQuestion({ onSelectChoice, onBreakMatch, questionState }: Argz) { | |
// Equiv to => | |
interface Argz { | |
question: MatchingQuestionUI; | |
questionState: MatchingQuestionState; | |
onSelectChoice: (choice: MatchingChoice) => void; | |
onBreakMatch: (choice: MatchingChoice) => void; | |
} | |
export function MatchingQuestion(props: Argz) { | |
const { onSelectChoice, onBreakMatch, questionState } = props | |
// So, its ok to not be destructuring all the properties out of the given props, and the order doesn't matter. | |
// Though the unused `question` prop should be deleted out of the inline interface def. 🧹 | |
// And I generally try to sort stuff alphabetically. `highlight lines, cmd+shift+p, Sort Lines Ascending)` for lines, | |
// manually for props w/in a destructure. Though *GOD DAMNIT* I am merely human 🧜🏻♂️ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For example I'd do this:
{
userId: string,
name: string,
profile: IUserProfile
}
Eff alphabetizing.