Mathpix / mathpix-markdown-it

Markdown rendering + Latex extras (equations, tables, ...), with conversion features, for the scientific community
MIT License
539 stars 45 forks source link

PR into master from dev/olga/update-react-version-v2 #307

Closed OlgaRedozubova closed 9 months ago

OlgaRedozubova commented 9 months ago

branch: dev/olga/update-react-version-v2

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

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.