-
However, in React, function components can return a ReactNode. This type includes number | string | Iterable | undefined and will likely also include Promise( in the future.
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
In an effort to address the issue described in the previous section, Sebastian opened a pull request to TypeScript: “RFC: Consult new JSX.ElementType for valid JSX element types". In that PR, Sebastian explained the issue and proposed a solution — introducing a new type, JSX.ElementType.
-
The TypeScript pull request was merged, so Sebastian (who helps maintain the React type definitions) exercised new powers in this pull request to the DefinitelyTyped repository for the React type definitions. At the time of writing, this pull request is still open, but once merged and shipped the React community we will feel its benefits.
Related posts
-
Functional Programming with TypeScript's Type System
-
TypeScript PR merged to allow components to return anything renderable (raw strings, numbers, promises for RSC), instead of just JSX.Element and null.
-
Thinking in ReScript
-
Merging to objects in a type-safe way with Lodash?
-
Why Become a TypeScript Fan?