You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
如果使用 const state=Taro.useState<Object[]>()
时,因为props.files也是必填字段
不能将类型“Object[]”分配给类型“File[]”。
"Object" 类型可分配给极少数其他类型。是否想要改用“任意”类型?
Property 'url' is missing in type 'Object' but required in type 'File'.
因为 props.files使用的interface是files: File[]所以定义类型也会报错。。。。。。
问题描述
AtImagePickerProps与taro hooks兼容性问题
复现步骤
期望行为
是否应当将类型定义修改,还是我的使用方法有误。
报错信息
类型“Object[]”的参数不能赋给类型“SetStateAction<never[]>”的参数。
不能将类型“Object[]”分配给类型“never[]”。
不能将类型“Object”分配给类型“never”。
"Object" 类型可分配给极少数其他类型。是否想要改用“任意”类型?
系统信息
补充信息
interface AtImagePickerProps extends AtComponent {
files: File[]
mode?: 'scaleToFill' | 'aspectFit' | 'aspectFill' | 'widthFix' | 'top' | 'bottom' | 'center' | 'left' | 'right' | 'top left' | 'top right' | 'bottom left' | 'bottom right'
showAddBtn?: boolean
multiple?: boolean
length?: number
count?: number
sizeType?: string[]
sourceType?: string[]
onChange: (files: Array, operationType: string, index: number) => void
onImageClick?: (index: number, file: Object) => void
onFail?: (message: string) => void
}
The text was updated successfully, but these errors were encountered: