When the typings for file-saver '@types/file-saver' are installed the code from your usage does not compile.
import { asBlob } from 'html-docx-js-typescript'
import { saveAs } from 'file-saver'
function saveDocx() {
asBlob("htmlString").then(data => {
saveAs(data, 'file.docx') // save as docx file
}) // asBlob() return Promise<Blob|Buffer>
}
Error Message:
error TS2769: No overload matches this call.
Overload 1 of 2, '(data: string | Blob, filename?: string | undefined, options?: FileSaverOptions | undefined): void', gave the following error.
Argument of type 'Blob | Buffer' is not assignable to parameter of type 'string | Blob'.
Type 'Buffer' is not assignable to type 'string | Blob'.
Type 'Buffer' is not assignable to type 'string'.
Overload 2 of 2, '(data: string | Blob, filename?: string | undefined, disableAutoBOM?: boolean | undefined): void', gave the following error.
Argument of type 'Blob | Buffer' is not assignable to parameter of type 'string | Blob'.
When the typings for file-saver '@types/file-saver' are installed the code from your usage does not compile.
Error Message:
error TS2769: No overload matches this call. Overload 1 of 2, '(data: string | Blob, filename?: string | undefined, options?: FileSaverOptions | undefined): void', gave the following error. Argument of type 'Blob | Buffer' is not assignable to parameter of type 'string | Blob'. Type 'Buffer' is not assignable to type 'string | Blob'. Type 'Buffer' is not assignable to type 'string'. Overload 2 of 2, '(data: string | Blob, filename?: string | undefined, disableAutoBOM?: boolean | undefined): void', gave the following error. Argument of type 'Blob | Buffer' is not assignable to parameter of type 'string | Blob'.
6 saveAs(data, 'file.docx') // save as docx file