返回博主主页

typescript的type还可以这么定义函数?

export type Dispatcher = {
  useState<S>(initialState: (() => S) | S): [S, Dispatch<BasicStateAction<S>>],
  useReducer<S, I, A>(
      reducer: (S, A) => S,
      initialArg: I,
      init?: (I) => S,
  ): [S, Dispatch<A>],
  useEffect(
      create: () => (() => void) | void,
      deps: Array<mixed> | void | null,
  ): void,
  // 其他hooks类型定义
}

 

 

function f(){console.log("434543454")}
var a={
  name: f,
}
a.name()

 

posted @ 2022-02-13 21:19  懒惰的星期六  阅读(65)  评论(0编辑  收藏  举报

Welcome to here

主页