compiled icon indicating copy to clipboard operation
compiled copied to clipboard

Issue with jsx types

Open nitedani opened this issue 2 years ago • 0 comments

Describe the bug When settings "jsxImportSource": "@compiled/react", in tsconfig.json, ReactNode becomes an invalid component return type.

To Reproduce Steps to reproduce the behavior:

const ComponentA = (): React.ReactNode => {
  return <div></div>;
};

const ComponentB = (): React.ReactNode => {
  return (
    <div>
      <ComponentA />
		^^^^^^
			'ComponentA' cannot be used as a JSX component.
  			Its return type 'ReactNode' is not a valid JSX element.ts(2786)
			const ComponentA: () => React.ReactNode
    </div>
  );
};

Expected behavior Align with the React types. ReactNode is a valid return type.

Screenshots image

nitedani avatar Dec 14 '23 23:12 nitedani