main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
474 bytes
|
Line | |
---|
1 | /**
|
---|
2 | * Ask TS to re-check that `A1` extends `A2`.
|
---|
3 | * And if it fails, `A2` will be enforced anyway.
|
---|
4 | * Can also be used to add constraints on parameters.
|
---|
5 | * @param A1 to check against
|
---|
6 | * @param A2 to cast to
|
---|
7 | * @returns `A1 | A2`
|
---|
8 | * @example
|
---|
9 | * ```ts
|
---|
10 | * import {A} from 'ts-toolbelt'
|
---|
11 | *
|
---|
12 | * type test0 = A.Cast<'42', string> // '42'
|
---|
13 | * type test1 = A.Cast<'42', number> // number
|
---|
14 | * ```
|
---|
15 | */
|
---|
16 | export declare type Cast<A1 extends any, A2 extends any> = A1 extends A2 ? A1 : A2;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.