Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript error while using rehype-raw with react-markdown #25

Closed
4 tasks done
slumbering opened this issue Sep 4, 2023 · 4 comments
Closed
4 tasks done

Typescript error while using rehype-raw with react-markdown #25

slumbering opened this issue Sep 4, 2023 · 4 comments
Labels
👯 no/duplicate Déjà vu 👎 phase/no Post cannot or will not be acted on

Comments

@slumbering
Copy link

slumbering commented Sep 4, 2023

Initial checklist

Affected packages and versions

"react-markdown": "^8.0.7", "rehype-raw": "^7.0.0"

Link to runnable example

No response

Steps to reproduce

1 - Create a new react project (NextJS project in my case).

npx create-next-app@latest

2 - Install React markdown

npm install react-markdown

3- Install rehype-raw

npm install rehype-raw

Now if you try to use rehype raw with react markdown, you should get the following error:
Capture d’écran 2023-09-04 à 10 14 46

Text version:

Type '(options?: Options | null | undefined) => (tree: Root, file: VFile) => Root' is not assignable to type 'Pluggable<any[]>'.
  Type '(options?: Options | null | undefined) => (tree: Root, file: VFile) => Root' is not assignable to type 'Plugin<any[], any, any>'.
    Type '(tree: Root, file: VFile) => Root' is not assignable to type 'void | Transformer<any, any>'.
      Type '(tree: Root, file: VFile) => Root' is not assignable to type 'Transformer<any, any>'.
        Types of parameters 'file' and 'file' are incompatible.
          Type 'import("/private/tmp/my-app/node_modules/vfile/lib/index").VFile' is not assignable to type 'import("/private/tmp/my-app/node_modules/hast-util-raw/node_modules/vfile/lib/index").VFile'.
            Types of property 'messages' are incompatible.
              Type 'import("/private/tmp/my-app/node_modules/vfile-message/lib/index").VFileMessage[]' is not assignable to type 'import("/private/tmp/my-app/node_modules/hast-util-raw/node_modules/vfile-message/lib/index").VFileMessage[]'.
                Type 'VFileMessage' is missing the following properties from type 'VFileMessage': ancestors, placets(2322)

Expected behavior

After updating rehype-raw from 6.1.1 to 7, the plugin should work seamlessly with react-markdown and not generate any TypeScript errors. It should be fully compatible right out of the box.

Actual behavior

I'm getting a typescript error after updating rehype-raw from 6.1.1 to 7

Runtime

Node v16

Package manager

npm 8

OS

macOS

Build and bundle tools

Next.js

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Sep 4, 2023
@wooorm
Copy link
Member

wooorm commented Sep 4, 2023

@wooorm wooorm closed this as completed Sep 4, 2023
@wooorm wooorm added the 👯 no/duplicate Déjà vu label Sep 4, 2023
@github-actions

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented Sep 4, 2023

Hi! Thanks for taking the time to contribute!

Because we treat issues as our backlog, we close duplicates to focus our work and not have to touch the same chunk of code for the same reason multiple times. This is also why we may mark something as duplicate that isn’t an exact duplicate but is closely related.

Thanks,
— bb

@github-actions

This comment was marked as resolved.

@github-actions github-actions bot added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👯 no/duplicate Déjà vu 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

2 participants