Skip to content

Disallow strings as children in React.

ts
import { ReactElement } from 'react';
interface ReactNodeArray extends Array<ReactNodeNoStrings> {}
export type ReactNodeNoStrings =
| ReactElement
| ReactNodeArray
| boolean
| null
| undefined;

· Discuss on Twitter