taro icon indicating copy to clipboard operation
taro copied to clipboard

FileSystemManager 相关方法的 typescript 类型定义不正确

Open janpoem opened this issue 5 years ago • 0 comments

这个特性解决了什么问题?

如:

fs.fstat,无此方法

fs.readFile,success: ({.data }) 提示无 data 变量,查看 d.ts ,对应的类型定义为:

interface ReadFileOption {
  /** 要读取的文件的路径 */
  filePath: string
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  complete?: (res: General.CallbackResult) => void
  /** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 */
  encoding?: keyof FileSystemManager.encoding
  /** 接口调用失败的回调函数 */
  fail?: (result: ReadFileFailCallbackResult) => void
  /** 接口调用成功的回调函数 */
  success?: (res: General.CallbackResult) => void
}

General.CallbackResult 只定义了:

interface CallbackResult {
  /** 错误信息 */
  errMsg: string
}

这个 API 长什么样?

希望完善 FileSystemManager 相关的类型定义,FileSystemManager 出现已经很久了,完善类型定义应该不难吧?

janpoem avatar Jun 01 '21 04:06 janpoem