@@ -19,6 +19,7 @@ import {
19
19
slash ,
20
20
type AdditionalConfig ,
21
21
type AdditionalConfigDict ,
22
+ type Awaitable ,
22
23
type HeadConfig ,
23
24
type SiteData
24
25
} from './shared'
@@ -34,46 +35,47 @@ const resolve = (root: string, file: string) =>
34
35
35
36
export type UserConfigFn < ThemeConfig > = (
36
37
env : ConfigEnv
37
- ) => UserConfig < ThemeConfig > | Promise < UserConfig < ThemeConfig > >
38
+ ) => Awaitable < UserConfig < ThemeConfig > >
38
39
export type UserConfigExport < ThemeConfig > =
39
- | UserConfig < ThemeConfig >
40
- | Promise < UserConfig < ThemeConfig > >
40
+ | Awaitable < UserConfig < ThemeConfig > >
41
41
| UserConfigFn < ThemeConfig >
42
42
43
43
/**
44
44
* Type config helper
45
45
*/
46
- export function defineConfig ( config : UserConfig < DefaultTheme . Config > ) {
46
+ export function defineConfig < ThemeConfig = DefaultTheme . Config > (
47
+ config : UserConfig < NoInfer < ThemeConfig > >
48
+ ) {
47
49
return config
48
50
}
49
51
52
+ export type AdditionalConfigFn < ThemeConfig > = (
53
+ env : ConfigEnv
54
+ ) => Awaitable < AdditionalConfig < ThemeConfig > >
55
+ export type AdditionalConfigExport < ThemeConfig > =
56
+ | Awaitable < AdditionalConfig < ThemeConfig > >
57
+ | AdditionalConfigFn < ThemeConfig >
58
+
50
59
/**
51
- * Type additional config helper
60
+ * Type config helper for additional/locale-specific config
52
61
*/
53
- export function defineAdditionalConfig (
54
- config : AdditionalConfig < DefaultTheme . Config >
62
+ export function defineAdditionalConfig < ThemeConfig = DefaultTheme . Config > (
63
+ config : AdditionalConfig < NoInfer < ThemeConfig > >
55
64
) {
56
65
return config
57
66
}
58
67
59
68
/**
60
69
* Type config helper for custom theme config
70
+ *
71
+ * @deprecated use `defineConfig` instead
61
72
*/
62
73
export function defineConfigWithTheme < ThemeConfig > (
63
74
config : UserConfig < ThemeConfig >
64
75
) {
65
76
return config
66
77
}
67
78
68
- /**
69
- * Type additional config helper
70
- */
71
- export function defineAdditionalConfigWithTheme < ThemeConfig > (
72
- config : AdditionalConfig < ThemeConfig >
73
- ) {
74
- return config
75
- }
76
-
77
79
export async function resolveConfig (
78
80
root : string = process . cwd ( ) ,
79
81
command : 'serve' | 'build' = 'serve' ,
0 commit comments