webdav-client icon indicating copy to clipboard operation
webdav-client copied to clipboard

feat: add ts overload to getFileContents

Open magicdawn opened this issue 2 years ago • 0 comments

so that we get explicit return type when different options provided

getFileContents({} as any, "/").then(res => res.byteLength); // res: BufferLike

getFileContents({} as any, "/", { format: "text" }).then(res => res.length); // res: string

getFileContents({} as any, "/", { details: true }).then(res => res.data.byteLength); // res: Detail<BufferLike>

getFileContents({} as any, "/", { details: true, format: "text" }).then(res => res.data.length); // res: Detail<string>

magicdawn avatar Jul 10 '22 08:07 magicdawn