Skip to content

Commit 17b7bcb

Browse files
authored
Define global WithNullValue<T> type (elastic#2497)
1 parent 3860792 commit 17b7bcb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

specification/_spec_utils/utils.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@ import { Stringified } from '@spec_utils/Stringified'
2626
*/
2727
export type NullValue = null
2828

29+
/**
30+
* `WithNullValue<T>` allows for explicit null assignments in contexts where `null` should be interpreted as an
31+
* actual value.
32+
*/
33+
export type WithNullValue<T> = T | NullValue
34+
2935
/**
3036
* Settings in Elasticsearch are values that can be reset to their default by setting them to the `null` value.
3137
*
3238
* @es_quirk Because of how they are implemented internally, settings are always returned as strings, even
3339
* if their value has been set using a primitive type.
3440
*/
35-
export type Setting<T> = Stringified<T> | NullValue
41+
export type Setting<T> = WithNullValue<Stringified<T>>

0 commit comments

Comments
 (0)