我正在尝试将此doSomething函数传递给performAction,但是我遇到的错误是Expected 0 arguments, but got 1
type someType = {
name: string,
id: string
}
function doSomethingFn(props: someType) {
console.log(props.name + " " + props.id);
}
function performAction(doSomething: () => void) {
doSomething({
name: "foo",
id: "bar"
});
}
performAction(doSomethingFn);
我是否为Typescript使用正确的语法?
胡说叔叔
互换的青春
相关分类