-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Address XS code hygiene tasks #4980
Conversation
Address the first 3 suggestions from microsoft#4968 As we remove `FC/VFC` I thought it'd be nice to add `ReactNode` return type basically to: - Serve as an additional hint that the function follows React Component signature - Limit usage of unsupported by React runtime return types
|
||
type ActivityAcknowledgementComposerProps = PropsWithChildren<{}>; | ||
type ActivityAcknowledgementComposerProps = Readonly<PropsWithChildren<{}>>; |
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.
This is my bad and lack of understanding about TypeScript couple of years ago. Could you help change this line to:
type ActivityAcknowledgementComposerProps = Readonly<PropsWithChildren<{}>>; | |
type ActivityAcknowledgementComposerProps = Readonly<{ children?: ReactNode | undefined }>; |
In TypeScript, {}
means any
. And it means I can put whatever inside the props. Recently learn about type-fest
package for TypeScript helpers. One of the helpers can define an empty object. 😉
|
||
type ActivityIdToKeyMap = Map<string, string>; | ||
type ActivityToKeyMap = Map<WebChatActivity, string>; | ||
type ClientActivityIdToKeyMap = Map<string, string>; | ||
type KeyToActivityMap = Map<string, WebChatActivity>; | ||
|
||
type ActivityKeyerComposerProps = Readonly<PropsWithChildren<{}>>; |
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.
type ActivityKeyerComposerProps = Readonly<PropsWithChildren<{}>>; | |
type ActivityKeyerComposerProps = Readonly<{ children?: ReactNode | undefined }>; |
|
||
// Magic numbers for `expiryByActivityKey`. | ||
const EXPIRY_SEND_FAILED = -Infinity; | ||
const EXPIRY_SENT = Infinity; | ||
|
||
const ActivitySendStatusComposer: FC<PropsWithChildren<{}>> = ({ children }) => { | ||
type ActivitySendStatusComposerProps = Readonly<PropsWithChildren<{}>>; |
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.
type ActivitySendStatusComposerProps = Readonly<PropsWithChildren<{}>>; | |
type ActivitySendStatusComposerProps = Readonly<{ children?: ReactNode | undefined }>; |
|
||
type ActivityTreeComposerProps = PropsWithChildren<{}>; | ||
type ActivityTreeComposerProps = Readonly<PropsWithChildren<{}>>; |
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.
type ActivityTreeComposerProps = Readonly<PropsWithChildren<{}>>; | |
type ActivityTreeComposerProps = Readonly<{ children?: ReactNode | undefined }>; |
Thanks William, good catch indead. I'll recreate the PR under the webchat repo for the CI PR pipeline to work |
Changelog Entry
Description
Address the first 3 suggestions from #4968
Design
Specific Changes
List of changes:
As we remove
FC/VFC
I thought it'd be nice to addReactNode
return type basically to:-
CHANGELOG.md
Review Checklist
z-index
)package.json
andpackage-lock.json
reviewed