File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ interface User {
7
7
maxConversionAmount : number ;
8
8
}
9
9
10
- type ConvertedCurrency = Brand < number , "ConvertedCurrency " > ;
10
+ type ConvertedAmount = Brand < number , "ConvertedAmount " > ;
11
11
type AuthorizedUser = Brand < User , "CurrencyAuthorizedUser" > ;
12
12
13
13
// Mocks a function that uses an API to convert
@@ -17,19 +17,19 @@ const getConversionRateFromApi = async (
17
17
from : string ,
18
18
to : string ,
19
19
) => {
20
- return Promise . resolve ( ( amount * 0.82 ) as ConvertedCurrency ) ;
20
+ return Promise . resolve ( ( amount * 0.82 ) as ConvertedAmount ) ;
21
21
} ;
22
22
23
23
// Mocks a function which actually performs the conversion
24
24
const performConversion = async (
25
25
user : AuthorizedUser ,
26
26
to : string ,
27
- amount : ConvertedCurrency ,
27
+ amount : ConvertedAmount ,
28
28
) => { } ;
29
29
30
30
const ensureUserCanConvert = (
31
31
user : User ,
32
- amount : ConvertedCurrency ,
32
+ amount : ConvertedAmount ,
33
33
) : AuthorizedUser => {
34
34
if ( user . maxConversionAmount < amount ) {
35
35
throw new Error ( "User cannot convert currency" ) ;
You can’t perform that action at this time.
0 commit comments