diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-07-05 01:58:36 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-07-05 01:58:36 +0800 |
commit | 196194c04aa5dca0b11e86158e510ec49cf72030 (patch) | |
tree | b936f02e1ca279535f4986cc6dfff58008808357 /src | |
parent | c5dca95f893cbc66d7e6d2de234f1411f28e1d19 (diff) | |
download | dexon-0x-contracts-196194c04aa5dca0b11e86158e510ec49cf72030.tar dexon-0x-contracts-196194c04aa5dca0b11e86158e510ec49cf72030.tar.gz dexon-0x-contracts-196194c04aa5dca0b11e86158e510ec49cf72030.tar.bz2 dexon-0x-contracts-196194c04aa5dca0b11e86158e510ec49cf72030.tar.lz dexon-0x-contracts-196194c04aa5dca0b11e86158e510ec49cf72030.tar.xz dexon-0x-contracts-196194c04aa5dca0b11e86158e510ec49cf72030.tar.zst dexon-0x-contracts-196194c04aa5dca0b11e86158e510ec49cf72030.zip |
Add StringEnum type
Diffstat (limited to 'src')
-rw-r--r-- | src/types.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/types.ts b/src/types.ts index 6eb769630..66881e170 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3,7 +3,10 @@ import * as Web3 from 'web3'; // Utility function to create a K:V from a list of strings // Adapted from: https://basarat.gitbooks.io/typescript/content/docs/types/literal-types.html -function strEnum(values: string[]): {[key: string]: string} { +export interface StringEnum { + [key: string]: string; +} +function strEnum(values: string[]): StringEnum { return _.reduce(values, (result, key) => { result[key] = key; return result; |