Sha256: b9c889d8a4595d02ebb3d3a72a335900b2fe9e5b5c54965da404379002b4ac44

Contents?: true

Size: 667 Bytes

Versions: 28

Compression:

Stored size: 667 Bytes

Contents

import type {WritableKeysOf} from './writable-keys-of';

/**
Creates a type that represents `true` or `false` depending on whether the given type has any writable fields.

This is useful when you want to create an API whose behavior depends on the presence or absence of writable fields.

@example
```
import type {HasWritableKeys, WritableKeysOf} from 'type-fest';

type UpdateService<Entity extends object> = {
	removeField: HasWritableKeys<Entity> extends true
		? (field: WritableKeysOf<Entity>) => Promise<void>
		: never
}
```

@category Utilities
*/
export type HasWritableKeys<BaseType extends object> = WritableKeysOf<BaseType> extends never ? false : true;

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
clapton-0.0.26 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.25 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.24 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.23 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.22 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.21 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.20 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.19 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.18 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.17 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.16 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.15 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.14 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.13 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.12 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.11 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.10 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.9 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.8 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts
clapton-0.0.7 lib/clapton/javascripts/node_modules/type-fest/source/has-writable-keys.d.ts