-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
migrate YouTube component to Typescript #6499
migrate YouTube component to Typescript #6499
Conversation
Gatsby Cloud Build Reportethereum-org-website-dev 🎉 Your build was successful! See the Deploy preview here. Build Details🕐 Build time: 13m PerformanceLighthouse report
|
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.
Hey @motemotech, thanks for the PR 💪😎
We should add type checks on the props
here using an interface and explicitly declare what the function returns (a React functional component)
e.g.
export interface IProps {
// props and types go here
}
const YouTube: (ADD A RETURN TYPE HERE) = ({ id, start = "0", title }) => {
...
}
Hi! Thank you @minimalsm !! |
@motemotech here's some documentation on this: https://github.com/ethereum/ethereum-org-website/blob/dev/docs/typescript.md |
@samajammin |
I've just changed my code. |
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.
Looks great @motemotech thanks for the contribution!
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.
Hey @motemotech, the start
prop should be optional as we only pass it when we want a YouTube video to start AFTER 0 seconds.
src/components/YouTube.tsx
Outdated
|
||
export interface IProps { | ||
id: string | ||
start: string |
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.
The start prop should be optional here.
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.
Is this correct?
start?: string
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.
@motemotech I just pushed a commit to make start
and title
as optional, and I gave them a default value.
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.
Thank you so much!
@all-contributors please add @motemotech for code |
I've put up a pull request to add @motemotech! 🎉 |
@motemotech be sure to join the discord if you are interested in contributing further to the project or have any questions for the team. And we've just released our 2022 POAPs so remember to claim yours also 🥳! |
I'm Nico! I already joined the discord! |
Description
Related Issue
#6392