-
Typescript: how do I tell it "if there is no children prop, require this other prop"? My type isn't working: { children?: never; screenReaderText: string; } | { children: React.ReactNode | string | Element; screenReaderText?: string; }
-
…in reply to @type__error
I'm assuming because
ReactNode
can be null or undefined. Components that don't have children OR screenReaderText aren't resulting in errors. -
…in reply to @type__error
Nope, it's because the component is a forwarded ref 🙃