emersonbottero / vitepress-plugin-mermaid

Add mermaid support for Vitepress
MIT License
95 stars 22 forks source link

TypeError for withMermaid config arguments #62

Closed aeyll-11 closed 1 year ago

aeyll-11 commented 1 year ago

Hello, I encountered this type error while employing defineConfig within the context of withMermaid.

Argument of type 'UserConfigExport<Config>' is not assignable to parameter of type 'UserConfig<any>'.
Type 'Promise<UserConfig<Config>>' has no properties in common with type 'UserConfig<any>'.ts(2345)

defineConfig in Vitepress yields UserConfigExport rather than a UserConfig

declare function defineConfig(config: UserConfigExport<DefaultTheme.Config>): UserConfigExport<DefaultTheme.Config>;
brc-dd commented 1 year ago

defineConfig is not needed if you're using withMermaid

aeyll-11 commented 1 year ago

@brc-dd Why do the repository use it that way then? https://github.com/emersonbottero/vitepress-plugin-mermaid/blob/main/docs/.vitepress/config.js

brc-dd commented 1 year ago

That's probably to provide hints for theme part. But which vitepress version are you on? It doesn't use UserConfigExport for defineConfig.

aeyll-11 commented 1 year ago

I use "vitepress": "^1.0.0-beta.2" line 41 https://github.com/vuejs/vitepress/blob/main/src/node/config.ts

brc-dd commented 1 year ago

That is just exported no longer used by defineConfig or anything. And IIRC beta 2 was the only version having that. Update your version to rc or something.

aeyll-11 commented 1 year ago

Thanks for the answer mate @brc-dd