我试着在角度上使用printJS,直到我不得不使用多个图像特性才行。我得到的printJS错误是没有定义的,并且在为导入寻找解决方案之后,我在这里得到了:https://github.com/crabbly/Print.js/issues/154。
尝试了进口的解决方案。但是现在我在初始化printJS时遇到了这个问题。
我想做的是:
//import
import printJSer from 'print-js'
...
// create a list first with the URLs
listImpressao.push(fileURL)
...
// try to print all images
if(tipo=='image'){
printJSer({printable: listImpressao, type:'image'})
}它给出了以下错误:
error TS2345:类型'{ printable: string[];type: string;}‘的参数不能分配给类型为’‘的参数。类型“{ printable: string[];type: string;}”不能分配到键入“Configuration”。属性“可打印”的类型是不兼容的。键入“string[]”不能指定键入“string”。
我需要做些什么来阻止这个错误?因为这个错误,我不能ng build这个应用程序。
发布于 2018-05-18 17:02:54
库的最新版本有一个更新的TypeScript接口。https://github.com/crabbly/Print.js/commit/3a3c60422a184560c07715eed0ee8d70f36ea393
可打印参数现在可以是字符串或数组。
只需运行npm update print-js,您就不会再得到该错误。
https://stackoverflow.com/questions/50402045
复制相似问题