main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
695 bytes
|
Line | |
---|
1 | /**
|
---|
2 | * Check whether `A1` is part of `A2` or not. The difference with
|
---|
3 | * `extends` is that it forces a [[Boolean]] return.
|
---|
4 | * @param A1
|
---|
5 | * @param A2
|
---|
6 | * @returns [[Boolean]]
|
---|
7 | * @example
|
---|
8 | * ```ts
|
---|
9 | * import {A} from 'ts-toolbelt'
|
---|
10 | *
|
---|
11 | * type test0 = A.Extends<'a' | 'b', 'b'> // Boolean
|
---|
12 | * type test1 = A.Extends<'a', 'a' | 'b'> // True
|
---|
13 | *
|
---|
14 | * type test2 = A.Extends<{a: string}, {a: any}> // True
|
---|
15 | * type test3 = A.Extends<{a: any}, {a: any, b: any}> // False
|
---|
16 | *
|
---|
17 | * type test4 = A.Extends<never, never> // False
|
---|
18 | * /// Nothing cannot extend nothing, use `A.Equals`
|
---|
19 | * ```
|
---|
20 | */
|
---|
21 | export declare type Extends<A1 extends any, A2 extends any> = [
|
---|
22 | A1
|
---|
23 | ] extends [never] ? 0 : A1 extends A2 ? 1 : 0;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.