Skip to content

Convert status-message component from JS to TS#9865

Merged
amirbey merged 6 commits intomainfrom
amirbey-brittany/doc-cap-js-ts
Jan 5, 2024
Merged

Convert status-message component from JS to TS#9865
amirbey merged 6 commits intomainfrom
amirbey-brittany/doc-cap-js-ts

Conversation

@amirbey
Copy link
Contributor

@amirbey amirbey commented Jan 5, 2024

🛠 Summary of changes

Convert the status-message component form JS to JS by by creating a StatusMesageProps.

@amirbey amirbey changed the title Amirbey brittany/doc cap js ts Convert status-message component from JS to TS Jan 5, 2024
Co-authored-by: Brittany Greaner <brittany.greaner@gsa.gov>
@amirbey amirbey force-pushed the amirbey-brittany/doc-cap-js-ts branch from ab87d27 to a40d823 Compare January 5, 2024 19:52
@amirbey amirbey marked this pull request as ready for review January 5, 2024 20:03
@amirbey amirbey assigned amirbey and night-jellyfish and unassigned amirbey Jan 5, 2024
SUCCESS: 'SUCCESS',
};
interface StatusMessageProps {
status: string;
Copy link
Contributor

@aduth aduth Jan 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@amirbey amirbey requested a review from aduth January 5, 2024 20:37
Copy link
Contributor

@aduth aduth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Comment on lines 12 to 16
}: {
status: Status;
className?: string;
children?: ReactNode;
}) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@amirbey amirbey merged commit 2b286f9 into main Jan 5, 2024
@amirbey amirbey deleted the amirbey-brittany/doc-cap-js-ts branch January 5, 2024 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants