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
Vite TypeScript error when building #191
Comments
Do you have a sample project that can demonstrate the issue? Which TypeScript version are you using? What is your I tried a basic example using the latest TypeScript and was not able to reproduce. |
Hi, it's a fresh vite + vue-ts app. Here's my configs
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"jsx": "preserve",
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"lib": ["esnext", "dom"],
"skipLibCheck": false
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
}
"devDependencies": {
"@vitejs/plugin-vue": "^1.2.5",
"@vue/compiler-sfc": "^3.0.5",
"typescript": "^4.3.2",
"vite": "^2.4.3",
"vue-tsc": "^0.0.24"
}, |
Thanks, I found a repro. Here it is: https://github.com/nolanlawson/repro-typescript-vue-issue Unfortunately I'm not much of a TypeScript expert, and I don't understand why it fails in a vue-ts project but not a vanilla TypeScript project. TypeScript is complaining about:
The definition causing the problem is emoji-picker-element/src/types/picker.ts Lines 31 to 33 in ad7c660
I borrowed this from some blog post about how to expose custom element TypeScript types, probably this one. I could just remove the Can you try some other custom element projects that fire events and see if they work in |
It looks like if you set |
@nolanlawson The actual error is here: So the definition says it won't accept values that can be Try to change the definiton to the following (I haven't actually tried to compile it): addEventListener<K extends keyof EmojiPickerEventMap>(type: K, listener: ((this: Picker, ev: EmojiPickerEventMap[K]) => any) /*the | null is new here*/ | null, options?: boolean | AddEventListenerOptions) {
super.addEventListener(type, listener, options);
} |
Thanks, I tried that, it didn't work. I found another solution though. |
Fixed in v1.6.5 |
Can confirm it's fixed in 1.6.5. Thank you! |
I have a Vite + Vue project which works fine on development, but when I try to build it, I get this error:
The solution for now is to set
skipLibCheck
totrue
but I'm worried all other declaration files will get skipped.I'm using the API btw.
The text was updated successfully, but these errors were encountered: