-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
typesRelated to typings onlyRelated to typings only
Description
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
const config = defineConfig({ ... });
if (versionBannerInfix) {
config.head?.push([
'script',
{ id: 'restore-banner-preference' },
`someScript()`,
]);
}
export default config;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
System:
OS: Windows 10 10.0.22621
CPU: (16) x64 Intel(R) Core(TM) i7-7820X CPU @ 3.60GHz
Memory: 52.73 GB / 63.69 GB
Binaries:
Node: 18.16.0 - C:\Program Files\nodejs\node.EXE
npm: 8.16.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.22621.1848.0), Chromium (114.0.1823.51)
Internet Explorer: 11.0.22621.1
npmPackages:
vitepress: 1.0.0-beta.2 => 1.0.0-beta.2Additional context
Found here: faker-js/faker#2216
// Vitepress Types
type UserConfigExport<ThemeConfig> = UserConfig<ThemeConfig> | Promise<UserConfig<ThemeConfig>> | UserConfigFn<ThemeConfig>;
declare function defineConfig(config: UserConfigExport<DefaultTheme.Config>): UserConfigExport<DefaultTheme.Config>;The first UserConfigExport variant is a somewhat special case as it is the only that makes sense to change afterwards.
Fix:
Export two signatures:
declare function defineConfig(config: UserConfig<DefaultTheme.Config>): UserConfig<DefaultTheme.Config>;
declare function defineConfig(config: UserConfigExport<DefaultTheme.Config>): UserConfigExport<DefaultTheme.Config>;Validations
- Check if you're on the latest VitePress version.
- Follow our Code of Conduct
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Metadata
Metadata
Assignees
Labels
typesRelated to typings onlyRelated to typings only