atlassian-labs / compiled

A familiar and performant compile time CSS-in-JS library for React.
https://compiledcssinjs.com
Apache License 2.0
1.98k stars 68 forks source link

Issue with jsx types #1593

Open nitedani opened 9 months ago

nitedani commented 9 months ago

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