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

upkeep: Add TS support for IsAdmin component #299

Merged
merged 3 commits into from
Mar 4, 2024

Conversation

Sidsector9
Copy link
Member

Description of the Change

Closes #

How to test the Change

Changelog Entry

Changed - Add TS support to IsAdmin component

Credits

Props @fabiankaegy @Sidsector9

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

Copy link

cypress bot commented Mar 1, 2024

Passing run #756 ↗︎

0 6 0 0 Flakiness 0

Details:

remove return type
Project: 10up Block Components Commit: d84d2a191b
Status: Passed Duration: 01:31 💡
Started: Mar 3, 2024 2:22 PM Ended: Mar 3, 2024 2:24 PM

Review all test suite changes for PR #299 ↗︎

Copy link

github-actions bot commented Mar 1, 2024

Size Change: 0 B

Total Size: 65.7 kB

ℹ️ View Unchanged
Filename Size
dist/index.js 65.7 kB

compressed-size-action

@Sidsector9 Sidsector9 self-assigned this Mar 1, 2024
Comment on lines 15 to 18
* @param {object} props react props
* @param {*} props.fallback fallback component
* @param {*} props.children child components
* @returns {*}
* @param {React.ReactNode|null} props.fallback fallback component
* @param {React.ReactNode} props.children child components
* @returns {null|React.ReactNode}
Copy link
Member

Choose a reason for hiding this comment

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

When we are adding types I think we can safely remove the JSDoc comments.

If we want to add additional context to the type we can add a comment above the type value like so:

interface IsAdminProps {
    /**
     * fallback component
     */
 	fallback: React.ReactNode | null;

    /**
     * child component
     */
 	children: React.ReactNode;
 }

@Sidsector9 Sidsector9 changed the title upkeep: Add TS support to IsAdmin component upkeep: Add TS support for IsAdmin component Mar 1, 2024
export const IsAdmin: React.FC<IsAdminProps> = ({
fallback = null,
children,
}): null | React.ReactNode => {
Copy link
Member

Choose a reason for hiding this comment

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

I still think we can leave the return type off here

@fabiankaegy fabiankaegy merged commit 35eed23 into develop Mar 4, 2024
7 of 8 checks passed
@fabiankaegy fabiankaegy deleted the upkeep/component-is-admin branch March 4, 2024 06:15
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.

2 participants