feat(api): add strict Setting types

This commit is contained in:
yassinedorbozgithub 2025-06-02 07:16:52 +01:00
parent 6d1c9850b9
commit bb5d029e68

View File

@ -6,6 +6,8 @@
* 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file).
*/
import { BaseSchema } from '@/utils/generics/base-schema';
import { Setting } from './setting.schema';
export enum SettingType {
@ -128,3 +130,17 @@ export type AnySetting =
| MultipleAttachmentSetting;
export type SettingDict = { [group: string]: Setting[] };
export type StrictSetting<
U,
E extends object = object,
K extends keyof BaseSchema = keyof BaseSchema,
> = U extends any
? {
[P in keyof U as P extends K
? never
: U[P] extends never
? never
: P]: U[P];
} & E
: never;