I am implementing MathpixMarkdown and MathpixLoader in a NextJS 13 environment and I have the following error:
'MathpixLoader' cannot be used as a JSX component.
Its type 'typeof MathpixLoader' is not a valid JSX element type.
Type 'typeof MathpixLoader' is not assignable to type 'new (props: any, deprecatedLegacyContext?: any) => Component<any, any, any>'.
Construct signature return types 'MathpixLoader' and 'Component<any, any, any>' are incompatible.
The types of 'refs' are incompatible between these types.
Type '{ [key: string]: import("/Users/ethan/code/opensource/mathpix-markdown-it/node_modules/@types/react/index").ReactInstance; }' is not assignable to type '{ [key: string]: React.ReactInstance; }'.
'string' index signatures are incompatible.
Type 'import("/Users/ethan/code/opensource/mathpix-markdown-it/node_modules/@types/react/index").ReactInstance' is not assignable to type 'React.ReactInstance'.
Type 'Component<any, {}, any>' is not assignable to type 'ReactInstance'.
Type 'import("/Users/ethan/code/opensource/mathpix-markdown-it/node_modules/@types/react/index").Component<any, {}, any>' is not assignable to type 'React.Component<any, {}, any>'.
The types returned by 'render()' are incompatible between these types.
Type 'import("/Users/ethan/code/opensource/mathpix-markdown-it/node_modules/@types/react/index").ReactNode' is not assignable to type 'React.ReactNode'.
Type '{}' is not assignable to type 'ReactNode'.ts(2786)
To fix this, I have updated the react related packages. I have run yarn test and everything passed, and I have linked this fix with my local project and it worked.
branch: dev/olga/update-react-version
This PR was created instead of PR https://github.com/Mathpix/mathpix-markdown-it/pull/285
Fixes:
https://github.com/Mathpix/mathpix-markdown-it/pull/285#issue-1978074176