问题描述
新手警报-第一次使用ReactJS和Javascript 6,并且大部分是边做边学。
我正在使用反应数据网格的canary版本,并参考示例here
我的相关代码是
const columns = [
{ key: 'merchant_name',name:"Merchant"},{ key: 'count',name: 'Count' },{ key: 'sum',name: 'Sum' },{
key: 'category',name:'Category',editable:true,editor: React.forwardRef((props,ref) => <DropDownEditor ref={ref} {...props} options={categories} />),}
];
但是此代码引发以下错误。
TypeScript error in /Users/sanchitsharma/Documents/frontend-spent-analyzer/src/features/transactions/merchant_grid.tsx(42,66):
Type '((instance: unknown) => void) | MutableRefObject<unknown> | null' is not assignable to type '((instance: DataGridHandle | null) => void) | RefObject<DataGridHandle> | null | undefined'.
Type 'MutableRefObject<unknown>' is not assignable to type '((instance: DataGridHandle | null) => void) | RefObject<DataGridHandle> | null | undefined'.
Type 'MutableRefObject<unknown>' is not assignable to type 'RefObject<DataGridHandle>'.
Types of property 'current' are incompatible.
Type 'unknown' is not assignable to type 'DataGridHandle | null'.
Type 'unknown' is not assignable to type 'DataGridHandle'. TS2322
40 | name:'Category',41 | editable:true,> 42 | editor: React.forwardRef((props,| ^
43 | }
44 | ];
我在做什么错了。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)