[英]Typescript type signature function array of objects parameter
What is the syntax to define onChange in this interface:在这个接口中定义 onChange 的语法是什么:
interface myInterface{
data: Type1
onChange : ({field: string, value: any}[]) => void
}
It gives me compile error on '=>' (; expected) I want to say onChange receives an array of field-value pair and return type is void.它给了我在'=>'(; 预期)上的编译错误我想说 onChange 接收到一个字段值对数组并且返回类型为 void。 What is the syntax?语法是什么?
Your forgot about :
你忘了:
interface myInterface{
data: Type1
onChange: (arr: {field: string, value: any}[]) => void
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.