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

[@types/react] ReactPortal extends ReactElement #28264

Merged
merged 1 commit into from Aug 26, 2018

Conversation

@tenorok
Copy link
Contributor

@tenorok tenorok commented Aug 21, 2018

Portals types works normal when used in method render() of Class-Component. But, it have breaks when used in Functional-Component:

function PortalComponent(props: { root: HTMLElement }) {
    return ReactDOM.createPortal(
        <div/>,
        props.root
    );
}

function MyComponent() {
    const root = document.getElementById('#foo');
    if (!root) {
        return null;
    }

    return (
        // JSX element type 'ReactPortal' is not a constructor function for JSX elements.
        // Property 'render' is missing in type 'ReactPortal'.
        <PortalComponent root={root}/>
    );
}

platform components viewer viewer tsx turbo 2018-08-21 15-49-12

Actually code is works fine.
Portal should extends from ReactElement similarly JSX.Element.

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).

If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes: https://reactjs.org/docs/portals.html
  • Increase the version number in the header if appropriate.
  • If you are making substantial changes, consider adding a tslint.json containing { "extends": "dtslint/dt.json" }.
@tenorok tenorok requested a review from johnnyreilly as a code owner Aug 21, 2018
@tenorok tenorok force-pushed the reactportal-fix branch from 2b315d6 to 83415dd Aug 21, 2018
@tenorok tenorok changed the title [@types/react][@types/react-dom] ReactPortal extends ReactElement [@types/react] ReactPortal extends ReactElement Aug 21, 2018
@typescript-bot
Copy link
Contributor

@typescript-bot typescript-bot commented Aug 21, 2018

@tenorok Thank you for submitting this PR!

🔔 @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @morcerf @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @Hotell - please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead.

@typescript-bot typescript-bot added this to Waiting for Reviewers in Pull Request Status Board Aug 21, 2018
@typescript-bot typescript-bot moved this from Waiting for Reviewers to Review in Pull Request Status Board Aug 26, 2018
@typescript-bot
Copy link
Contributor

@typescript-bot typescript-bot commented Aug 26, 2018

After 5 days, no one has reviewed the PR 😞. A maintainer will be reviewing the PR in the next few days and will either merge it or request revisions. Thank you for your patience!

@johnnyreilly johnnyreilly merged commit 3e39c3e into DefinitelyTyped:master Aug 26, 2018
1 check passed
@johnnyreilly
Copy link
Member

@johnnyreilly johnnyreilly commented Aug 26, 2018

Thanks!

@tenorok tenorok deleted the reactportal-fix branch Aug 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants