当前位置: 首页 > news >正文

pnpm monoreop 打包时 node_modules 内部包 typescript 不能推导出类型报错

报错信息如下:

../../packages/antdv/components/pro-table/src/form-render.vue:405:1 - error TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/scroll-into-view-if-needed@2.2.31/node_modules/scroll-into-view-if-needed'. This is likely not portable. A type annotation is necessary.405 export default (await import('vue')).defineComponent({~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
406 setup() {~~~~~~~~~
... 
412 __typeEl: {} as __VLS_TemplateResult['rootEl'],~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
413 });~~~
../../packages/antdv/components/pro-table/src/form-render.vue:405:1 - error TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/vue-types@3.0.2_vue@3.5.13_typescript@5.8.2_/node_modules/vue-types'. This is likely not portable. A type annotation is necessary.405 export default (await import('vue')).defineComponent({~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
406 setup() {~~~~~~~~~
... 
412 __typeEl: {} as __VLS_TemplateResult['rootEl'],~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
413 });

he inferred type of 'default' cannot be named without a reference to '.pnpm/scroll-into-view-if-needed@2.2.31/node_modules/scroll-into-view-if-needed'. This is likely not portable. A type annotation is necessary.

看了一下lock文件,scroll-into-view-if-needed,vue-types这两个依赖主要是ant-design-vue使用的,为什么会报错呢,因为之前vue的版本是3.4.x,现在整到了3.5.13,降到 3.4.x就没问题了

根据这个报错搜索了一下,看到的解决方案就是把报错的包在 tsconfig.json配置一下

{"compilerOptions": {"target": "ESNext","jsx": "preserve","jsxImportSource": "vue","lib": ["ESNext"],"baseUrl": ".","module": "ESNext","moduleResolution": "Node",// 在这配置一下"paths": {"scroll-into-view-if-needed": ["node_modules/scroll-into-view-if-needed"],"vue-types": ["node_modules/vue-types"]},"resolveJsonModule": true,"strict": true,"noImplicitAny": false,"allowSyntheticDefaultImports": true,"esModuleInterop": true,"preserveSymlinks": true,"skipLibCheck": true}
}
http://www.xdnf.cn/news/136189.html

相关文章:

  • 电力系统惯性与惯量关系解析
  • day003
  • 你的图数传模块该换了!
  • Python Transformers 库介绍
  • RHEL与CentOS:从同源到分流的开源操作系统演进
  • 简述:变更调查的历史情况
  • 计算机网络核心知识点全解析(面试通关版)
  • 插入html文件,让数据可视化彰显高端大气-Excel易用宝
  • 安全编排自动化与响应(SOAR):从事件响应到智能编排的技术实践
  • cgroup sched_cfs_bandwidth_slice参数的作用及效果
  • 【5】GD32 基础通信外设:USART、I2C、SPI
  • 【playwright】 page.get_by_类型方法
  • 【RedisLockRegistry】分布式锁
  • NS3-虚拟网络与物理网络的交互-2 FdNetDevice文件描述符网络设备
  • CMake ctest
  • 手搓传染病模型(SIR)
  • Git 入门知识详解
  • 人工智能与机器学习:Python从零实现逻辑回归模型
  • 【中级软件设计师】函数调用 —— 传值调用和传地址调用 (附软考真题)
  • 分享Matlab成功安装Support Package硬件支持包的方法
  • 第二章 信息技术发展(2.1 信息技术及其发展)
  • 达梦数据库运维
  • 常见缓存淘汰算法(LRU、LFU、FIFO)的区别与实现
  • MYSQL 常用字符串函数 和 时间函数详解
  • MyBatisPlus文档
  • 路由器的基础配置全解析:静态动态路由 + 华为 ENSP 命令大全
  • 一种专用车辆智能配电模块的设计解析:技术革新与未来展望
  • 京东以图搜图(拍立淘)API接口返回参数详解
  • ALTER TABLE 之痛 - 为何我们需要在线表结构变更?
  • 大数据开发环境的安装,配置(Hadoop)