diff --git a/.changeset/early-mice-deliver.md b/.changeset/early-mice-deliver.md new file mode 100644 index 000000000..067730691 --- /dev/null +++ b/.changeset/early-mice-deliver.md @@ -0,0 +1,5 @@ +--- +'@linaria/react': patch +--- + +Update types to support old React diff --git a/packages/react/src/styled.ts b/packages/react/src/styled.ts index 9e6e5781d..cc933f29b 100644 --- a/packages/react/src/styled.ts +++ b/packages/react/src/styled.ts @@ -107,25 +107,13 @@ interface IProps { style?: Record; } -// React <19 -declare global { - // eslint-disable-next-line @typescript-eslint/no-namespace - namespace JSX { - interface IntrinsicElements {} - } -} - -// React >=19 -declare module 'react' { - // eslint-disable-next-line @typescript-eslint/no-namespace - namespace JSX { - interface IntrinsicElements {} - } -} - let idx = 0; -type IntrinsicElements = React.JSX.IntrinsicElements & JSX.IntrinsicElements; +interface IntrinsicElements + // in newer react types JSX is moved under React namespace + // @ts-expect-error ts 2694 + extends React.JSX.IntrinsicElements, + JSX.IntrinsicElements {} // Components with props are not allowed function styled(