-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hints: fix hints type on PerseusItem to be correct #1489
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ed42843
Hints: fix hints type on PerseusItem to be correct
jeremywiebe c28bd40
Explain 'replace' key with comment
jeremywiebe ce7be37
Changeset
jeremywiebe 03165cc
Fix hint type on HintsRenderer
jeremywiebe 3752db8
Remove 'replace' key from PerseusRenderer (specific to hints, not all…
jeremywiebe 0a0fa72
Don't need to clone the array before using `concat()`. It creates a n…
jeremywiebe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@khanacademy/perseus": patch | ||
"@khanacademy/perseus-editor": patch | ||
--- | ||
|
||
Correct `hints` type on ItemRenderer |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,7 +87,7 @@ export type PerseusItem = { | |
// The details of the question being asked to the user. | ||
question: PerseusRenderer; | ||
// A collection of hints to be offered to the user that support answering the question. | ||
hints: ReadonlyArray<PerseusRenderer>; | ||
hints: ReadonlyArray<Hint>; | ||
// Details about the tools the user might need to answer the question | ||
answerArea: PerseusAnswerArea | null | undefined; | ||
// Multi-item should only show up in Test Prep content and it is a variant of a PerseusItem | ||
|
@@ -127,6 +127,15 @@ export type PerseusRenderer = { | |
}; | ||
}; | ||
|
||
export type Hint = PerseusRenderer & { | ||
/** | ||
* When `true`, causes the previous hint to be replaced with this hint when | ||
* displayed. When `false`, the previous hint remains visible when this one | ||
* is displayed. | ||
*/ | ||
replace?: boolean; | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! Yes, we can remove it now! |
||
|
||
export type PerseusImageDetail = { | ||
// The width of the image | ||
width: number; | ||
|
This file contains 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving away from
_
gives us better typing.