diff options
Diffstat (limited to 'app/lib/ipc-facade.js')
| -rw-r--r-- | app/lib/ipc-facade.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/app/lib/ipc-facade.js b/app/lib/ipc-facade.js index 19daf71b97..ff2b7050ed 100644 --- a/app/lib/ipc-facade.js +++ b/app/lib/ipc-facade.js @@ -1,14 +1,16 @@ // @flow import JsonRpcWs, { InvalidReply } from './jsonrpc-ws-ipc'; -import { object, string, number, arrayOf } from 'validated/schema'; +import { object, string, arrayOf, number } from 'validated/schema'; import { validate } from 'validated/object'; +import type { Coordinate2d } from '../types'; + export type AccountData = {paid_until: string}; export type AccountNumber = string; export type Ip = string; export type Location = { - latlong: Array<number>, + latlong: Coordinate2d, country: string, city: string, }; @@ -90,7 +92,8 @@ export class RealIpc implements IpcFacade { return this._ipc.send('get_location') .then(raw => { try { - return validate(LocationSchema, raw); + const validated: any = validate(LocationSchema, raw); + return (validated: Location); } catch (e) { throw new InvalidReply(raw, e); } |
