From 17b7bcbb6dbd4be563d3e0548c409bd835d4743d Mon Sep 17 00:00:00 2001 From: Jedr Blaszyk Date: Tue, 9 Apr 2024 14:56:13 +0200 Subject: [PATCH] Define global WithNullValue type (#2497) --- specification/_spec_utils/utils.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/specification/_spec_utils/utils.ts b/specification/_spec_utils/utils.ts index 4118a86dc8..d408d9d774 100644 --- a/specification/_spec_utils/utils.ts +++ b/specification/_spec_utils/utils.ts @@ -26,10 +26,16 @@ import { Stringified } from '@spec_utils/Stringified' */ export type NullValue = null +/** + * `WithNullValue` allows for explicit null assignments in contexts where `null` should be interpreted as an + * actual value. + */ +export type WithNullValue = T | NullValue + /** * Settings in Elasticsearch are values that can be reset to their default by setting them to the `null` value. * * @es_quirk Because of how they are implemented internally, settings are always returned as strings, even * if their value has been set using a primitive type. */ -export type Setting = Stringified | NullValue +export type Setting = WithNullValue>