react-querybuilder
Version:
React Query Builder component for constructing queries and filters, with utilities for executing them in various database and evaluation contexts
25 lines (19 loc) • 481 B
text/typescript
import type { IsNever } from "./is-never.mjs";
/**
An if-else-like type that resolves depending on whether the given type is `never`.
@see {@link IsNever}
@example
```
import type {IfNever} from 'type-fest';
type ShouldBeTrue = IfNever<never>;
//=> true
type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
//=> 'bar'
```
@group type-fest
*/
export type IfNever<
T,
TypeIfNever = true,
TypeIfNotNever = false
> = (IsNever<T> extends true ? TypeIfNever : TypeIfNotNever);