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

[react] Add default value for PropsWithChildren type parameter #60641

Merged

Conversation

jakubmazanec
Copy link
Contributor

Adds default value for PropsWithChildren type parameter, so user can more easily create component that have children, but have no props, e.g.:

import {FC, PropsWithChildren} from 'react';

let Bold: React.FC<PropsWithChildren> = ({children}) => <b>{children}</b>;  // previously user had to annotate with `React.FC<PropsWithChildren<unknown>>`

@typescript-bot
Copy link
Contributor

typescript-bot commented Jun 2, 2022

@jakubmazanec Thank you for submitting this PR! I see this is your first time submitting to DefinitelyTyped 👋 — I'm the local bot who will help you through the process of getting things through.

This is a live comment which I will keep updated.

1 package in this PR

Code Reviews

Because this is a widely-used package, a DT maintainer will need to review it before it can be merged.

You can test the changes of this PR in the Playground.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ Most recent commit is approved by a DT maintainer

All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 60641,
  "author": "jakubmazanec",
  "headCommitOid": "b2b6bf994fb004d5cae57103b104a6418ca5bb54",
  "mergeBaseOid": "9c24ecfc8499db04243c0ca303fa4b22bdb33624",
  "lastPushDate": "2022-06-02T21:26:17.000Z",
  "lastActivityDate": "2022-06-05T20:42:35.000Z",
  "mergeOfferDate": "2022-06-04T01:22:46.000Z",
  "mergeRequestDate": "2022-06-05T20:42:35.000Z",
  "mergeRequestUser": "jakubmazanec",
  "hasMergeConflict": false,
  "isFirstContribution": true,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "react",
      "kind": "edit",
      "files": [
        {
          "path": "types/react/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react/test/tsx.tsx",
          "kind": "test"
        }
      ],
      "owners": [
        "johnnyreilly",
        "bbenezech",
        "pzavolinsky",
        "ericanderson",
        "DovydasNavickas",
        "theruther4d",
        "guilhermehubner",
        "ferdaber",
        "jrakotoharisoa",
        "pascaloliv",
        "hotell",
        "franklixuefei",
        "Jessidhia",
        "saranshkataria",
        "lukyth",
        "eps1lon",
        "zieka",
        "dancerphil",
        "dimitropoulos",
        "disjukr",
        "vhfmag",
        "hellatan",
        "priyanshurav"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "domdomegg",
      "date": "2022-06-05T10:47:19.000Z",
      "isMaintainer": false
    },
    {
      "type": "approved",
      "reviewer": "eps1lon",
      "date": "2022-06-04T10:13:38.000Z",
      "isMaintainer": false
    },
    {
      "type": "approved",
      "reviewer": "rbuckton",
      "date": "2022-06-04T01:22:07.000Z",
      "isMaintainer": true
    }
  ],
  "mainBotCommentID": 1145363472,
  "ciResult": "pass"
}

@typescript-bot
Copy link
Contributor

@DangerBotOSS
Copy link

Inspecting the JavaScript source for this package found some properties that are not in the .d.ts files.
The check for missing properties isn't always right, so take this list as advice, not a requirement.

react (unpkg)

was missing the following properties:

  1. unstable_act

Generated by 🚫 dangerJS against b2b6bf9

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board Jun 2, 2022
@typescript-bot typescript-bot added Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner labels Jun 4, 2022
@typescript-bot
Copy link
Contributor

@jakubmazanec: Everything looks good here. I am ready to merge this PR (at b2b6bf9) on your behalf whenever you think it's ready.

If you'd like that to happen, please post a comment saying:

Ready to merge

and I'll merge this PR almost instantly. Thanks for helping out! ❤️

(@johnnyreilly, @bbenezech, @pzavolinsky, @ericanderson, @DovydasNavickas, @theruther4d, @guilhermehubner, @ferdaber, @jrakotoharisoa, @pascaloliv, @Hotell, @franklixuefei, @Jessidhia, @saranshkataria, @lukyth, @eps1lon, @zieka, @dancerphil, @dimitropoulos, @disjukr, @vhfmag, @hellatan, @priyanshurav: you can do this too.)

@typescript-bot typescript-bot moved this from Needs Maintainer Review to Waiting for Author to Merge in New Pull Request Status Board Jun 4, 2022
@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label Jun 4, 2022
@typescript-bot typescript-bot added the Other Approved This PR was reviewed and signed-off by a community member. label Jun 5, 2022
@jakubmazanec
Copy link
Contributor Author

Ready to merge

@typescript-bot typescript-bot moved this from Waiting for Author to Merge to Recently Merged in New Pull Request Status Board Jun 5, 2022
@typescript-bot typescript-bot merged commit 8959643 into DefinitelyTyped:master Jun 5, 2022
@typescript-bot typescript-bot removed this from Recently Merged in New Pull Request Status Board Jun 6, 2022
HoonBaek added a commit to sendbird/sendbird-uikit-react that referenced this pull request Dec 11, 2023
### Issue
* [Can't use `PropsWithChildren` because of type
error](DefinitelyTyped/DefinitelyTyped#60641)
* Not assignable to type error, property 'children' doesn't exist on
type `PropsWithChildren`
* [Can't use `PropsWithChildren<{}>` because of lint
error](https://stackoverflow.com/questions/65548388/react-propswithchildren-with-no-props-other-than-children)

### Fix
* Use Use `PropsWithChildren<unknown>` instead `PropsWithChildren`

### ChangeLog
* Fix a type error from SendbirdProvider
* Not assignable to type error, property 'children' doesn't exist on
type `PropsWithChildren`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Critical package Maintainer Approved Other Approved This PR was reviewed and signed-off by a community member. Owner Approved A listed owner of this package signed off on the pull request. Self Merge This PR can now be self-merged by the PR author or an owner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants