Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@driusan
Copy link
Collaborator

@driusan driusan commented Nov 13, 2023

This converts the InfoPanel component from JavaScript to TypeScript in order to make it easier to import/type check in TS (without affecting the ability to load it in JS.)

(The component is small enough that this is easier than writing a .d.ts file and keeping it in sync.)

This converts the InfoPanel component from JavaScript
to TypeScript in order to make it easier to import/type check
in TS (without affecting the ability to load it in JS.)

(The component is small enough that this is easier than
writing a .d.ts file and keeping it in sync.)
* @returns {ReactNode} - the InfoPanel
*/
function InfoPanel(props) {
function InfoPanel(props: {children: ReactNode}): ReactNode {
Copy link
Contributor

@laemtl laemtl Nov 13, 2023

Choose a reason for hiding this comment

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

const InfoPanel : React.FC<{children: ReactNode}> = (props) => {

Copy link
Contributor

@laemtl laemtl Nov 13, 2023

Choose a reason for hiding this comment

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

Use generics to inherit React.FC type definition

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't understand.. what parent type definitions? It is a functional component (which presumably is what the FC stands for in your example, but there is no parent..)

Copy link
Contributor

Choose a reason for hiding this comment

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

Making use of the React.FC generic type will specifies the return type. But it seems it will be deprecated soon, so let's leave it as is: facebook/create-react-app#8177

@laemtl laemtl self-requested a review November 13, 2023 19:59
@driusan driusan merged commit 43d2070 into aces:main Nov 13, 2023
@ridz1208 ridz1208 added this to the 26.0.0 milestone Apr 9, 2024
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.

3 participants