在我的应用程序中,我尝试开发将角格式转换为PDF格式的方法,我在stackblitz中看到了一个例子,但是当我试图在本地遵循相同的代码时,导入就不起作用了?错误为could not find the declaration for "pdfmake/build/pdfmake"
import pdfMake from "pdfmake/build/pdfmake";
import pdfFonts from "pdfmake/build/vfs_fonts";
pdfMake.vfs = pdfFonts.pdfMake.vfs;更新:我已经尝试安装“@type/pdfmake”来修复这个问题。它部分修复了,但在"pdfmake.vfs“中抛出了cannot assign to vfs because it is readonly property错误
import * as pdfMake from "pdfmake/build/pdfmake";
import * as pdfFonts from "pdfmake/build/vfs_fonts";
pdfMake.vfs= pdfFonts.pdfMake.vfs;发布于 2022-11-16 14:06:23
请试试这个,它对我有用:
import * as pdfMake from "pdfmake/build/pdfmake";
import * as pdfFonts from 'pdfmake/build/vfs_fonts';
(pdfMake as any).vfs = pdfFonts.pdfMake.vfs;https://stackoverflow.com/questions/67986856
复制相似问题