Convert status-message component from JS to TS#9865
Merged
Conversation
zachmargolis
reviewed
Jan 5, 2024
app/javascript/packages/document-capture/components/status-message.tsx
Outdated
Show resolved
Hide resolved
app/javascript/packages/document-capture/components/status-message.tsx
Outdated
Show resolved
Hide resolved
zachmargolis
approved these changes
Jan 5, 2024
Co-authored-by: Brittany Greaner <brittany.greaner@gsa.gov>
ab87d27 to
a40d823
Compare
aduth
reviewed
Jan 5, 2024
| SUCCESS: 'SUCCESS', | ||
| }; | ||
| interface StatusMessageProps { | ||
| status: string; |
Contributor
There was a problem hiding this comment.
We've changed the type of this from Status to string, which is less strict than we had it. Can we preserve the Status type in TypeScript?
| @@ -7,19 +7,13 @@ export const Status = { | |||
| ERROR: 'ERROR', | |||
Contributor
There was a problem hiding this comment.
Somewhat related to my previous comment, this might be a good opportunity to use TypeScript native enums? It's one of the few language "features" of TypeScript that isn't strictly typings-related.
aduth
approved these changes
Jan 5, 2024
Comment on lines
12
to
16
| }: { | ||
| status: Status; | ||
| className?: string; | ||
| children?: ReactNode; | ||
| }) { |
Contributor
There was a problem hiding this comment.
I personally like having a named interface StatusMessageProps like you had prior to f3cee1f, since otherwise I think the arguments section becomes symbol soup, but it's a small detail.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🛠 Summary of changes
Convert the status-message component form JS to JS by by creating a StatusMesageProps.