Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node_modules/vue-cropper/lib/index.ts:1:24 - error TS7016: Could not find a declaration file for module './vue-cropper.vue'. #810

Open
zcodecn opened this issue Apr 24, 2024 · 1 comment

Comments

@zcodecn
Copy link

zcodecn commented Apr 24, 2024

node_modules/vue-cropper/lib/index.ts:1:24 - error TS7016: Could not find a declaration file for module './vue-cropper.vue'. 'E:/Workspaces/zcode/zcode-ui/node_modules/vue-cropper/lib/vue-cropper.vue' implicitly has an 'any' type.

1 import VueCropper from './vue-cropper.vue'

如上所述,运行npm run build时报这个错

@HobaiRiku
Copy link

next版本的ts支持我觉得是错误的,只是在开发这个库的时候能用type,因为项目定义的typings里面关于vue-cropper.vue的type定义是缺失的,我觉得应该在编译SFC的时候也要把SFC的类型用vue-tsc生成并做好引入,这里type check肯定过不了,只适合非type工程。如果不想整个项目添加"noImplicitAny": false。那么,在项目全局的自定义上,比如vite-env.d.ts,上添加:

declare module '*vue-cropper.vue' {
  import { defineComponent } from 'vue'
  const component: ReturnType<typeof defineComponent>
  export default component
}

来workaround。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants