mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 12:11:47 +00:00
feat: conditionally typed BalanceLine
This commit is contained in:
Vendored
+6
-3
@@ -556,14 +556,17 @@ export namespace Server {
|
||||
balance: string;
|
||||
asset_type: ASSET_TYPE.native;
|
||||
}
|
||||
interface BalanceLineAsset {
|
||||
interface BalanceLineAsset<T extends ASSET_TYPE.credit4 | ASSET_TYPE.credit12 = ASSET_TYPE.credit4 | ASSET_TYPE.credit12> {
|
||||
balance: string;
|
||||
limit: string;
|
||||
asset_type: ASSET_TYPE.credit4 | ASSET_TYPE.credit12;
|
||||
asset_type: T;
|
||||
asset_code: string;
|
||||
asset_issuer: string;
|
||||
}
|
||||
type BalanceLine = BalanceLineNative | BalanceLineAsset;
|
||||
type BalanceLine<T extends ASSET_TYPE = ASSET_TYPE> =
|
||||
T extends ASSET_TYPE.native ? BalanceLineNative :
|
||||
T extends ASSET_TYPE.credit4 | ASSET_TYPE.credit12 ? BalanceLineAsset<T> :
|
||||
BalanceLineNative | BalanceLineAsset;
|
||||
|
||||
interface AccountRecord extends Record {
|
||||
id: string;
|
||||
|
||||
Reference in New Issue
Block a user