-
-
Notifications
You must be signed in to change notification settings - Fork 364
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
Type errors on builded library #4377
Comments
Seems like a typescript issue to me (tsconfig.json). |
I tried updating typescript in a project created with npm create vue@3.3. Library types work. Have you tried building a simple library with typescript types on the latest version of Vue? |
I copied the tsconfig files i used to work with building an UI lib. Also you don't have to pass Here: FanilZarip/test-lib-build@lib_build_with_dts...RayGuo-ergou:test-lib-build:lib_build_with_dts |
Hi! I've created a library with your configs and trying to use it in a new Vue project. But there are still type errors when using it. My repo with test library. I pack it with npm pack and install locally from /src/local_repo And type errors screen. |
You are building with --build again. You should understand how it and tsconfig references works first. I also recommend you to start a new project with vite create. |
Here I build it with your tsconfig and pack with npm pack Then (github link below) I use this npm package and run type checking and language-tools do not show types. I create vue project with vuejs recommended way. npm create vue@latest. It is clear project with ts. And i wait that config will run well from box. Also if I run just vue-tsc --watch, yes it is do not show any type errors. But if i use uncorrect props value type it also do not show type error. In my screen I use BaseButton with type="out" instead of "outline" and vscode and vue-tsc do not show errors for types https://github.com/FanilZarip/test_use_own_library/tree/test_own_lib Yes I am beginner at TS and Library building. |
Not really sure what you mean but all working fine on my side. ( I also used Maybe you missed this, in your ui lib's package.json. You need to declare where the type file is. "exports": {
".": {
+ "types": "./dist/types/index.d.ts",
"import": "./dist/testui.es.ts",
"require": "./dist/testui.umd.ts"
},
"./styles": "./dist/style.css"
}, |
also tried your repo, works fine, guessing you just missed that part. |
Yes, You are right. It was vite-plugin-dts problem with default tsconfig Thanks! |
vite-plugin-dts error explained here |
Hi! I tried build library with vite-plugin-dts and without it.
Both build packages have type errors.
Package was created on last vue with npm create vue@latest
I also tried build on older vue version with npm create vue@3.3 and library build success. It's don't have type errors when i use my own package on older version
My test repo with dts plugin
https://github.com/FanilZarip/test-lib-build/tree/lib_build_with_dts
My test repo without dts plugin
https://github.com/FanilZarip/test-lib-build/tree/build_without_dts_plugin
The text was updated successfully, but these errors were encountered: