Quo*_*ran 14 typescript redux typescript-typings
今天我在 Typescript 中遇到了一些问题。
这个类型中的三个点是什么意思?我根本找不到任何可以解释这一点的东西。
知道它是 Redux 的 mergeReducers 函数返回的类型推断
编辑:我编辑了图片,以便我们看得更清楚。
EDIT2:我在这里添加代码,我正在尝试做这样的事情
let all: { readonly [key: string]: (...args: any) => any } = {
form,
metadatas_reducer,
loader_reducer
}
const combinedReducer = combineReducers(all)
Run Code Online (Sandbox Code Playgroud)
谢谢。
这是 TypeScript 扩展运算符: https://howtodoinjava.com/typescript/spread-operator/
它还可以解构传入的数组和字典,因此您可以通过执行以下操作来合并两个字典:
> a = [1,2,3]
[ 1, 2, 3 ]
> b = [4,5,6]
[ 4, 5, 6 ]
> [a,b]
[ [ 1, 2, 3 ], [ 4, 5, 6 ] ]
> [...a,...b]
[ 1, 2, 3, 4, 5, 6 ]
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
11004 次 |
最近记录: |