Change custom network typing

This commit is contained in:
HenryNguyen5 2018-01-27 15:20:47 -05:00
parent dd896d197d
commit 86f8302d2b
2 changed files with 2 additions and 4 deletions

View File

@ -7,12 +7,10 @@ import {
import { CustomNetworkConfig } from 'reducers/config/networks/typings'; import { CustomNetworkConfig } from 'reducers/config/networks/typings';
// TODO: this doesn't accurately represent state, as // TODO: this doesn't accurately represent state, as
interface State1 { export interface State {
[customNetworkId: string]: CustomNetworkConfig; [customNetworkId: string]: CustomNetworkConfig;
} }
export type State = Partial<State1>;
const addCustomNetwork = (state: State, { payload }: AddCustomNetworkAction): State => ({ const addCustomNetwork = (state: State, { payload }: AddCustomNetworkAction): State => ({
...state, ...state,
[payload.id]: payload.config [payload.id]: payload.config

View File

@ -35,7 +35,7 @@ export const getNetworkContracts = (state: AppState): NetworkContract[] | null =
return network ? network.contracts : []; return network ? network.contracts : [];
}; };
export const getCustomNetworkConfigs = (state: AppState): (CustomNetworkConfig | undefined)[] => { export const getCustomNetworkConfigs = (state: AppState): CustomNetworkConfig[] => {
const { customNetworks } = getNetworks(state); const { customNetworks } = getNetworks(state);
return Object.values(customNetworks); return Object.values(customNetworks);
}; };