type fixes

This commit is contained in:
Travis Eden 2018-08-02 09:41:44 -04:00 committed by Sean Yesmunt
parent 64623ad30a
commit d14fa2e248
4 changed files with 20 additions and 20 deletions

22
dist/bundle.js vendored
View file

@ -1481,14 +1481,9 @@ var _action_types = __webpack_require__(4);
var ACTIONS = _interopRequireWildcard(_action_types); var ACTIONS = _interopRequireWildcard(_action_types);
var _Notification = __webpack_require__(1);
var _Notification2 = _interopRequireDefault(_Notification);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
/*:: import type { Notification, NotificationProps } from 'types/Notification';*/
function doNotify(notification /*: Notification*/, notificationProps /*: NotificationProps*/) { function doNotify(notification /*: Notification*/, notificationProps /*: NotificationProps*/) {
return { return {
type: ACTIONS.CREATE_NOTIFICATION, type: ACTIONS.CREATE_NOTIFICATION,
@ -4259,12 +4254,13 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
// @flow // @flow
var DEFAULTSEARCHRESULTSIZE = 10; var DEFAULTSEARCHRESULTSIZE = 10;
var DEFAULTSEARCHRESULTFROM = 0; var DEFAULTSEARCHRESULTFROM = 0;
/*:: type Dispatch = (action: any) => any;*/
/*:: type GetState = () => {};*/
var doSearch = exports.doSearch = function doSearch(rawQuery) { var doSearch = exports.doSearch = function doSearch(rawQuery) {
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULTSEARCHRESULTSIZE; var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULTSEARCHRESULTSIZE;
var from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULTSEARCHRESULTFROM; var from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULTSEARCHRESULTFROM;
var isBackgroundSearch = arguments[3]; var isBackgroundSearch = arguments[3];
return function (dispatch, getState) { return function (dispatch /*: Dispatch*/, getState /*: GetState*/) {
var state = getState(); var state = getState();
var query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' '); var query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' ');
@ -4360,7 +4356,7 @@ var getSearchSuggestions = exports.getSearchSuggestions = function getSearchSugg
}; };
var doUpdateSearchQuery = exports.doUpdateSearchQuery = function doUpdateSearchQuery(query /*: string*/, shouldSkipSuggestions /*: ?boolean*/) { var doUpdateSearchQuery = exports.doUpdateSearchQuery = function doUpdateSearchQuery(query /*: string*/, shouldSkipSuggestions /*: ?boolean*/) {
return function (dispatch) { return function (dispatch /*: Dispatch*/) {
dispatch({ dispatch({
type: ACTIONS.UPDATE_SEARCH_QUERY, type: ACTIONS.UPDATE_SEARCH_QUERY,
data: { query: query } data: { query: query }
@ -4374,7 +4370,7 @@ var doUpdateSearchQuery = exports.doUpdateSearchQuery = function doUpdateSearchQ
}; };
var doFocusSearchInput = exports.doFocusSearchInput = function doFocusSearchInput() { var doFocusSearchInput = exports.doFocusSearchInput = function doFocusSearchInput() {
return function (dispatch) { return function (dispatch /*: Dispatch*/) {
return dispatch({ return dispatch({
type: ACTIONS.SEARCH_FOCUS type: ACTIONS.SEARCH_FOCUS
}); });
@ -4382,7 +4378,7 @@ var doFocusSearchInput = exports.doFocusSearchInput = function doFocusSearchInpu
}; };
var doBlurSearchInput = exports.doBlurSearchInput = function doBlurSearchInput() { var doBlurSearchInput = exports.doBlurSearchInput = function doBlurSearchInput() {
return function (dispatch) { return function (dispatch /*: Dispatch*/) {
return dispatch({ return dispatch({
type: ACTIONS.SEARCH_BLUR type: ACTIONS.SEARCH_BLUR
}); });
@ -6306,8 +6302,8 @@ reducers[ACTIONS.WALLET_LOCK_FAILED] = function (state /*: WalletState*/, action
}; };
function walletReducer() { function walletReducer() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState; var state /*: WalletState*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
var action = arguments[1]; var action /*: ActionResult*/ = arguments[1];
var handler = reducers[action.type]; var handler = reducers[action.type];
if (handler) return handler(state, action); if (handler) return handler(state, action);

View file

@ -1,6 +1,6 @@
// @flow // @flow
import * as ACTIONS from 'constants/action_types'; import * as ACTIONS from 'constants/action_types';
import Notification from 'types/Notification'; import type { Notification, NotificationProps } from 'types/Notification';
export function doNotify(notification: Notification, notificationProps: NotificationProps) { export function doNotify(notification: Notification, notificationProps: NotificationProps) {
return { return {

View file

@ -8,13 +8,15 @@ import handleFetchResponse from 'util/handle-fetch';
const DEFAULTSEARCHRESULTSIZE = 10; const DEFAULTSEARCHRESULTSIZE = 10;
const DEFAULTSEARCHRESULTFROM = 0; const DEFAULTSEARCHRESULTFROM = 0;
type Dispatch = (action: any) => any;
type GetState = () => {};
export const doSearch = ( export const doSearch = (
rawQuery, rawQuery,
size = DEFAULTSEARCHRESULTSIZE, size = DEFAULTSEARCHRESULTSIZE,
from = DEFAULTSEARCHRESULTFROM, from = DEFAULTSEARCHRESULTFROM,
isBackgroundSearch isBackgroundSearch
) => (dispatch, getState) => { ) => (dispatch: Dispatch, getState: GetState) => {
const state = getState(); const state = getState();
const query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' '); const query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' ');
@ -81,7 +83,7 @@ export const doSearch = (
}); });
}; };
export const getSearchSuggestions = (value: string) => (dispatch, getState) => { export const getSearchSuggestions = (value: string) => (dispatch: Dispatch) => {
const query = value.trim(); const query = value.trim();
// strip out any basic stuff for more accurate search results // strip out any basic stuff for more accurate search results
@ -114,7 +116,9 @@ export const getSearchSuggestions = (value: string) => (dispatch, getState) => {
}); });
}; };
export const doUpdateSearchQuery = (query: string, shouldSkipSuggestions: ?boolean) => dispatch => { export const doUpdateSearchQuery = (query: string, shouldSkipSuggestions: ?boolean) => (
dispatch: Dispatch
) => {
dispatch({ dispatch({
type: ACTIONS.UPDATE_SEARCH_QUERY, type: ACTIONS.UPDATE_SEARCH_QUERY,
data: { query }, data: { query },
@ -126,12 +130,12 @@ export const doUpdateSearchQuery = (query: string, shouldSkipSuggestions: ?boole
} }
}; };
export const doFocusSearchInput = () => dispatch => export const doFocusSearchInput = () => (dispatch: Dispatch) =>
dispatch({ dispatch({
type: ACTIONS.SEARCH_FOCUS, type: ACTIONS.SEARCH_FOCUS,
}); });
export const doBlurSearchInput = () => dispatch => export const doBlurSearchInput = () => (dispatch: Dispatch) =>
dispatch({ dispatch({
type: ACTIONS.SEARCH_BLUR, type: ACTIONS.SEARCH_BLUR,
}); });

View file

@ -275,7 +275,7 @@ reducers[ACTIONS.WALLET_LOCK_FAILED] = (state: WalletState, action: ActionResult
walletLockResult: action.result, walletLockResult: action.result,
}); });
export function walletReducer(state = defaultState, action) { export function walletReducer(state: WalletState = defaultState, action: ActionResult) {
const handler = reducers[action.type]; const handler = reducers[action.type];
if (handler) return handler(state, action); if (handler) return handler(state, action);
return state; return state;