Skip to content
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

refactor: replace React.FC and interface with direct declaration and type #12014

Conversation

TylerAPfledderer
Copy link
Contributor

@TylerAPfledderer TylerAPfledderer commented Jan 25, 2024

Description

To update the project to be inline with the latest code convention docs, this PR does the following:

  • Replace all instances of the React.FC type with direct component prop declaration
// From
const Component: React.FC<Props> = (props) => JSX.Element

// To
const Component = (props: Props) => JSX.Element
  • Replace all instances of interface with type for component prop shapes only in order to provide typing constraint.
  • Provide meaningful naming to type aliases of all component props that matches the name of the component .
  • Remove redundant type signatures. i.e. Redundant instance of type signatures similar to ChildOnlyProp
  • Other cleanup and adjustments as necessary for the above changes

Side note: This helps in addressing other possible type constraint additions, such as better typing for custom MDX components, where type errors might arise from conflicts with React.FC

Related Issue

N/A

Copy link

netlify bot commented Jan 25, 2024

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit aade323
🔍 Latest deploy log https://app.netlify.com/sites/ethereumorg/deploys/65bb3895b9791d0008e077a7
😎 Deploy Preview https://deploy-preview-12014--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@TylerAPfledderer TylerAPfledderer force-pushed the refactor/replace-fc-with-plain-prop-declare branch from c30daa5 to 92743d6 Compare January 25, 2024 04:22
@github-actions github-actions bot added content 🖋️ This involves copy additions or edits tooling 🔧 Changes related to tooling of the project labels Jan 25, 2024
@TylerAPfledderer TylerAPfledderer force-pushed the refactor/replace-fc-with-plain-prop-declare branch from 92743d6 to 37cc2de Compare January 27, 2024 00:27
@TylerAPfledderer TylerAPfledderer force-pushed the refactor/replace-fc-with-plain-prop-declare branch from 37cc2de to 3e971b6 Compare January 27, 2024 04:51
Copy link
Member

@corwintines corwintines left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks @TylerAPfledderer!

@corwintines corwintines merged commit 3e83d04 into ethereum:dev Feb 1, 2024
6 of 7 checks passed
@TylerAPfledderer TylerAPfledderer deleted the refactor/replace-fc-with-plain-prop-declare branch February 1, 2024 12:40
This was referenced Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content 🖋️ This involves copy additions or edits tooling 🔧 Changes related to tooling of the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants