import type {OptionalKeysOf} from './optional-keys-of.d.ts'; /** Extract all required keys from the given type. This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc... @example ``` import type {RequiredKeysOf} from 'type-fest'; declare function createValidation = RequiredKeysOf>(field: Key, validator: (value: Entity[Key]) => boolean): ValidatorFn; interface User { name: string; surname: string; luckyNumber?: number; } const validator1 = createValidation('name', value => value.length < 25); const validator2 = createValidation('surname', value => value.length < 25); ``` @category Utilities */ export type RequiredKeysOf = Type extends unknown // For distributing `Type` ? Exclude> : never; // Should never happen export {};