elasticsearch-js
elasticsearch-js copied to clipboard
enum and/or type guard for QueryDslTextQueryType
🚀 Feature Proposal
We have a usecase where we receive/produce string
as a type, which should be typed as QueryDslTextQueryType
. I would like to have a way in this library (as single source of truth) to produce a QueryDslTextQueryType
from a string.
Motivation
It's much better if the guard is produced and maintained tightly with this library.
Example
enum QueryDslTextQueryType {
// the values of QueryDslTextQueryType union type
}
function isQueryDslTextQueryType(arg: any): arg is QueryDslTextQueryType {
return Object.values(QueryDslTextQueryType).includes(arg)
}