frontend/.pnpm-store/v3/files/89/c7f7dd48a5543a5320dbcf587fdceb9fe2118fdb61425c6fc56198b33e33088d41688c6fcb9cedca8a0fafa2dcec3f667a6b6e8bd01347d2787f2aca2989f9

22 lines
662 B
Plaintext

import {OptionalKeysOf} from './optional-keys-of';
/**
Creates a type that represents `true` or `false` depending on whether the given type has any optional fields.
This is useful when you want to create an API whose behavior depends on the presence or absence of optional fields.
@example
```
import type {HasOptionalKeys, OptionalKeysOf} from 'type-fest';
type UpdateService<Entity extends object> = {
removeField: HasOptionalKeys<Entity> extends true
? (field: OptionalKeysOf<Entity>) => Promise<void>
: never
}
```
@category Utilities
*/
export type HasOptionalKeys<BaseType extends object> = OptionalKeysOf<BaseType> extends never ? false : true;