为什么不能正确完成车道?
带有const isErrorAction =
<A extends IAction & { error?: any }>(a: A): a is A & { error: true } =>
(a.error)
const isRequestAction =
<A extends IAction & { meta?: { isPending?: any } }>(
a: A
): a is A & { meta: { isPending: true } } =>
(a.meta && a.meta.isPending);
const handleAsyncAction = <S, A extends IAction>(
handlers: IAsyncHandlers<S, A>
): IReducer<S, A> => {
function reducer(state: S, action: A): S {
if (isErrorAction(action)) {
return getActionHandler(handlers.failure)(state)(action);
}
// not strictly necessary to narrow here, but why not
if (isRequestAction(action)) {
return getActionHandler(handlers.request)(state)(action);
}
return getActionHandler(handlers.success)(state)(action);
}
return reducer;
};
选项的控制台输出:
/Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane_core/lib/fastlane_core/ui/interface.rb:172:in `test_failure!': [!] Test execution failed. Exit status: 1 (FastlaneCore::Interface::FastlaneTestFailure) from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane_core/lib/fastlane_core/ui/ui.rb:17:in `method_missing' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/scan/lib/scan/runner.rb:87:in `handle_results' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/scan/lib/scan/runner.rb:22:in `run' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/scan/lib/scan/manager.rb:18:in `work' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/actions/run_tests.rb:23:in `run' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/runner.rb:253:in `block (2 levels) in execute_action' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/actions/actions_helper.rb:50:in `execute_action' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/runner.rb:232:in `block in execute_action' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/runner.rb:227:in `chdir' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/runner.rb:227:in `execute_action' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/fast_file.rb:149:in `method_missing' from Fastfile:109:in `block in parsing_binding' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/lane.rb:33:in `call' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/runner.rb:45:in `chdir' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/runner.rb:45:in `execute' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/lane_manager.rb:56:in `cruise_lane' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/commands_generator.rb:108:in `block (2 levels) in run' from /Library/Ruby/Gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in `call' from /Library/Ruby/Gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:in `run' from /Library/Ruby/Gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in `run_active_command' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:74:in `run!' from /Library/Ruby/Gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in `run!' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/commands_generator.rb:333:in `run' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/commands_generator.rb:41:in `start' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/fastlane/lib/fastlane/cli_tools_distributor.rb:108:in `take_off' from /Library/Ruby/Gems/2.3.0/gems/fastlane-2.104.0/bin/fastlane:20:in `' from /usr/local/bin/fastlane:22:in `load' from /usr/local/bin/fastlane:22:in `'