rehype-pretty / rehype-pretty-code

Beautiful code blocks for Markdown or MDX.
https://rehype-pretty.pages.dev
MIT License
1.05k stars 64 forks source link

version 10.0.2 type error in unfied.use() #123

Closed tidecat-owo closed 11 months ago

tidecat-owo commented 11 months ago

Hi:

My Problem:

.In my Next APP, I use the rehype-pretty-code with unified , but got a typescript error. my unified version is 11.0.4.

Error Information:

Argument of type '(options?: void | Options | undefined) => void | Transformer<Root, Root>' is not assignable to parameter of type 'Plugin<[options?: void | Options | undefined], Root, Root>'. Type 'void | Transformer<Root, Root>' is not assignable to type 'void | Transformer<Root, Root> | undefined'. Type 'Transformer<Root, Root>' is not assignable to type 'void | Transformer<Root, Root> | undefined'. Type 'import("c:/Users/promi/Desktop/nahz-blog/node_modules/rehype-pretty-code/node_modules/unified/index").Transformer<import("c:/Users/promi/Desktop/nahz-blog/node_modules/rehype-pretty-code/node_modules/@types/hast/index").Root, import("c:/Users/promi/Desktop/nahz-blog/node_modules/rehype-pretty-code/node_modules/@type...' is not assignable to type 'import("c:/Users/promi/Desktop/nahz-blog/node_modules/unified/lib/index").Transformer<import("c:/Users/promi/Desktop/nahz-blog/node_modules/rehype-pretty-code/node_modules/@types/hast/index").Root, import("c:/Users/promi/Desktop/nahz-blog/node_modules/rehype-pretty-code/node_modules/@types/hast/index").Root>'. Types of parameters 'file' and 'file' are incompatible. Type 'import("c:/Users/promi/Desktop/nahz-blog/node_modules/vfile/lib/index").VFile' is not assignable to type 'import("c:/Users/promi/Desktop/nahz-blog/node_modules/rehype-pretty-code/node_modules/vfile/lib/index").VFile'. Types of property 'messages' are incompatible. Type 'import("c:/Users/promi/Desktop/nahz-blog/node_modules/vfile-message/lib/index").VFileMessage[]' is not assignable to type 'import("c:/Users/promi/Desktop/nahz-blog/node_modules/rehype-pretty-code/node_modules/vfile-message/lib/index").VFileMessage[]'. Property 'position' is missing in type 'import("c:/Users/promi/Desktop/nahz-blog/node_modules/vfile-message/lib/index").VFileMessage' but required in type 'import("c:/Users/promi/Desktop/nahz-blog/node_modules/rehype-pretty-code/node_modules/vfile-message/lib/index").VFileMessage'.ts(2345) index.d.ts(71, 3): 'position' is declared here.

I appreciate if you can help to resolve this problem...❤

atomiks commented 11 months ago

Does installing @types/hast fix it?