这篇文章是用来专门记录关于React 18 + Hooks +Ts 开发中遇到的问题及解决方案

Q1

TS7016: Could not find a declaration file for module 
'js-export-excel'. '/Users/zhangliangliang/WebstormProjects/daizhang-system-front/node_modules/js-export-excel/lib/index.js' 
implicitly has an 'any' type.<br/>Try `npm i --save-dev @types/js-export-excel` 
if it exists or add a new declaration (.d.ts) file containing `declare module 'js-export-excel';`

总结:引用插件 考虑Ts 适配问题

Q2

修复代码,已经声明了变量v和mainBusinessIncome:

'主营业务收入' :  v.mainBusinessIncome ? (mainBusinessIncome / 100).toFixed(2) : '';

总结:需要对变量类型进行明确

11-14 13:52