Definitelytyped: [React] Support array of elements in render function

Created on 6 Aug 2017  路  2Comments  路  Source: DefinitelyTyped/DefinitelyTyped

  • [x] I tried using the @types/react package and had "problems".
  • [x] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • [x] I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • [x] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

    • Authors: @johnnyreilly, @bbenezech, @pzavolinsky, @digiguru, @ericanderson, @morcerf, @tkrotoff, @DovydasNavickas, @onigoetz, @richseviora

Typescript: Version 2.5.0-dev.20170803

Currently the type for React.Component::render does not support an array of elements as return type, yet they are supported by React 16 (Fiber).

One could simply change the function type to:

render(): JSX.Element | JSX.Element[] | null | false;

But I am not quire sure about react-dom's render function which has many overloads.

Most helpful comment

19363

All 2 comments

Ping.

19363

Was this page helpful?
0 / 5 - 0 ratings