UNPKG

705 BTypeScriptView Raw
1import { Extends } from './Extends';
2/**
3 * Check whether `A1` is part of `A2` or not. It works like
4 * [[Extends]] but [[Boolean]] results are narrowed to [[False]].
5 * @param A1
6 * @param A2
7 * @returns [[Boolean]]
8 * @example
9 * ```ts
10 * type test0 = A.Contains<'a' | 'b', 'b'> // False
11 * type test1 = A.Contains<'a', 'a' | 'b'> // True
12 *
13 * type test2 = A.Contains<{a: string}, {a: string, b: number}> // False
14 * type test3 = A.Contains<{a: string, b: number}, {a: string}> // True
15 *
16 * type test4 = A.Contains<never, never> // False
17 * /// Nothing cannot contain nothing, use `A.Equals`
18 * ```
19 */
20export declare type Contains<A1 extends any, A2 extends any> = Extends<A1, A2> extends 1 ? 1 : 0;