diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2018-01-03 10:33:12 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-01-03 10:33:12 +0100 |
| commit | 3abf2afec5e2d7b21b8dcee32c6d240299848cbd (patch) | |
| tree | 8c5cd55b7cc24c8598c9590c778f762fd4e0ce2d /app | |
| parent | 272ec721ff55579dceddfbf186578cab10b808cf (diff) | |
| parent | 015a39d928ce33f4b6bc3a7d142f68de1ce79847 (diff) | |
| download | mullvadvpn-3abf2afec5e2d7b21b8dcee32c6d240299848cbd.tar.xz mullvadvpn-3abf2afec5e2d7b21b8dcee32c6d240299848cbd.zip | |
Merge branch 'style-helpers-flow-annotations'
Diffstat (limited to 'app')
| -rw-r--r-- | app/lib/styles.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/lib/styles.js b/app/lib/styles.js index c75d73236b..840c7c79ab 100644 --- a/app/lib/styles.js +++ b/app/lib/styles.js @@ -1,6 +1,10 @@ +// @flow + import { Styles } from 'reactxp'; -export function createViewStyles(styles: { [string]: Object }) { +type ExtractReturnType = (*) => Object; + +export function createViewStyles<T: { [string]: Object }>(styles: T): $ObjMap<T, ExtractReturnType> { const viewStyles = {}; for (const style of Object.keys(styles)) { viewStyles[style] = Styles.createViewStyle(styles[style]); @@ -8,7 +12,7 @@ export function createViewStyles(styles: { [string]: Object }) { return viewStyles; } -export function createTextStyles(styles: { [string]: Object }) { +export function createTextStyles<T: { [string]: Object }>(styles: T): $ObjMap<T, ExtractReturnType> { const textStyles = {}; for (const style of Object.keys(styles)) { textStyles[style] = Styles.createTextStyle(styles[style]); |
