fix(settings): Ensure that InferSettings properly infers the combinations of values from an enum type. (#10346)

This commit is contained in:
Richie Foreman
2025-10-01 11:32:18 -04:00
committed by GitHub
parent b3ff2b0e39
commit 206bad7bef
+7 -3
View File
@@ -1047,9 +1047,13 @@ export function getSettingsSchema(): SettingsSchemaType {
type InferSettings<T extends SettingsSchema> = {
-readonly [K in keyof T]?: T[K] extends { properties: SettingsSchema }
? InferSettings<T[K]['properties']>
: T[K]['default'] extends boolean
? boolean
: T[K]['default'];
: T[K]['type'] extends 'enum'
? T[K]['options'] extends readonly SettingEnumOption[]
? T[K]['options'][number]['value']
: T[K]['default']
: T[K]['default'] extends boolean
? boolean
: T[K]['default'];
};
export type Settings = InferSettings<SettingsSchemaType>;