Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[TypeScript] Convert InfoPanel.js to TypeScript #8944

Merged
merged 1 commit into from
Nov 13, 2023

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.)
*/
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
19 checks passed
@ridz1208 ridz1208 added this to the 26.0.0 milestone Apr 9, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants