TypeScript箭头函数双返回

TypeScript箭头函数双返回,typescript,ecmascript-6,arrow-functions,Typescript,Ecmascript 6,Arrow Functions,我一直在阅读一些用TS编写的React代码,我遇到了以下代码: const loggedInRequired = () => ( toState: State, fromState: State, // tslint:disable-next-line:no-any done: any ) => { // userIsLoggedIn can be whatever you need it to be if (isAuthenticat

我一直在阅读一些用TS编写的React代码,我遇到了以下代码:

const loggedInRequired = () => (
    toState: State,
    fromState: State,
    // tslint:disable-next-line:no-any
    done: any
) => {
    // userIsLoggedIn can be whatever you need it to be
    if (isAuthenticated()) {
      return true;
    } else {
      // redirect to signin page if the user isn't logged in
      done({ redirect: { name: Routes.Login } });
      return false;
    }
  };
我想知道这一特定部分的含义:

() => (someParam: someType, someOtherParam: someType) => { someCodeHere }
第二组括号之间的部分代表什么?它看起来像一个接口,但我看不到它背后的逻辑,
done
显然是一个函数,因为我们稍后在代码中调用它,但我无法理解此代码的一般含义

编辑

只是我有点迟钝。

这是一个函数(从
()=>
开始),它返回另一个函数(另一个函数从
开始(toState:State,fromState:State,done:any)=>

当您调用
loggedInRequired
时,结果将是一个函数

const loggedInRequiredResult = loggedInRequired (); // will be a (toState: any, fromState: any, done: any) => boolean
const finalResult = loggedInRequiredResult (null, null, null) // will be a boolean
它是一个函数(从
()=>
)返回另一个函数(另一个函数从
(toState:State,fromState:State,done:any)=>

当您调用
loggedInRequired
时,结果将是一个函数

const loggedInRequiredResult = loggedInRequired (); // will be a (toState: any, fromState: any, done: any) => boolean
const finalResult = loggedInRequiredResult (null, null, null) // will be a boolean

亲爱的上帝,我觉得自己很迟钝,缺乏睡眠或其他什么,真的不是我的错。上帝啊,我觉得自己很迟钝,缺乏睡眠或其他什么,真的不是我的错