remarkjs / react-remark

React component and hook to use remark to render markdown
https://remarkjs.github.io/react-remark
MIT License
204 stars 7 forks source link

Type conflict / Update to unified v10 #62

Closed reckter closed 1 year ago

reckter commented 1 year ago

Initial checklist

Affected packages and versions

react-remark@2.1.0

Link to runnable example

No response

Steps to reproduce

I've tried to update @types/unist to v3 from v2, but that causes a type error when trying to give Remark a list of plugins:

Type '() => (tree: Node) => Node' is not assignable to type 'Pluggable<any[], Settings>'.
  Type '() => (tree: Node) => Node' is not assignable to type 'Plugin<any[], Settings>'.
    Type '(tree: Node) => Node' is not assignable to type 'void | Transformer'.
      Type '(tree: Node) => Node' is not assignable to type 'Transformer'.
        Type 'Node' is not assignable to type 'void | Error | Node<Data> | Promise<Node<Data>> | Promise<void>'.
          Type 'Node' is not assignable to type 'Node<Data>'.
            Types of property 'data' are incompatible.
              Type 'import("[...]/node_modules/.pnpm/@types+unist@3.0.0/node_modules/@types/unist/index").Data | undefined' is not assignable to type 'import("[...]/node_modules/.pnpm/@types+unist@2.0.6/node_modules/@types/unist/index").Data | undefined'.
                Type 'import("[...]/node_modules/.pnpm/@types+unist@3.0.0/node_modules/@types/unist/index").Data' is not assignable to type 'import("[...]/node_modules/.pnpm/@types+unist@2.0.6/node_modules/@types/unist/index").Data'.
                  Index signature for type 'string' is missing in type 'Data'.

178       remarkPlugins={[remarkEntityLinks]}
                          ~~~~~~~~~~~~~~~~~

This seems to be, because react-remark is still using unified@9.x, which intern is still depending on @types/unist@2.x.

Expected behavior

The types work with the most up to date versions of @types/unist

Actual behavior

There is a type conflict in the Node type between @types/unist@2 and @types/unist@3

Runtime

No response

Package manager

No response

OS

No response

Build and bundle tools

No response

ChristianMurphy commented 1 year ago

Thanks for reaching out @reckter! 👋

This is a duplicate of #50

The next major release will support unified 11 and remark 15 (currently in the process of being released) based off the work in https://github.com/remarkjs/react-remark/pull/39 As noted in https://github.com/remarkjs/react-remark/issues/54 there are a few higher priority releases that need attention before I'll finish this. If you are interested feel free to work on any of the checklist of planned changes in https://github.com/remarkjs/react-remark/pull/39 to help accelerate that time-line.