-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Cannot edit the config after calling defineConfig anymore #2524
Comments
Ah yeah. We are aware of this. I'll push the changes with overloads tomorrow. It broke typings in some other plugins too. If it's blocking, you can use ts-ignore for now. (Only the types were broken, the functionality is same as earlier.) |
It doesn't really block us, only the dependency update. |
Okay, so what you suggested, and what I had initially in mind won't work. It breaks typings for patterns like these: defineConfig(() => ({ // <-- can be async, doesn't work unless you add empty parameter (_) or ({})
// complex stuff here (like our own docs config)
})) There was an attempt at narrowing types in Vite too: vitejs/vite#12021, vitejs/vite#12077 -- that broke typings and intellisense too 👀 TS is getting kind of confused between promises and functions. At the moment I'd recommend you to directly import import type { UserConfig, DefaultTheme } from 'vitepress'
const config: UserConfig<DefaultTheme.Config> = { ... } |
Describe the bug
After the update from 1.0.0-beta.1 to 1.0.0-beta.2 I get a type error when trying to alter the config:
Reproduction
Working reproduction: https://github.com/faker-js/faker/blob/a6f5a39fff65d8923aab6db8a05a3ab79d097896/docs/.vitepress/config.ts#L257-L272
Expected behavior
I expect it to still work.
System Info
Additional context
Found here: faker-js/faker#2216
The first
UserConfigExport
variant is a somewhat special case as it is the only that makes sense to change afterwards.Fix:
Export two signatures:
Validations
The text was updated successfully, but these errors were encountered: