2.5.17
https://stackblitz.com/edit/typescript-bc9ywj
index.ts
, you will see:x: [String, Number, Array]
to x: [String, Number]
, then errors disappear:no typing errors.
typing errors exist.
Check https://vuejs.org/v2/guide/typescript.html
Please, next time consider using the forum, the Discord server or StackOverflow for questions first. But feel free to come back and open an issue if it turns out to be a bug 🙂
@posva i know, but i think this is a bug.
@ktsn can you help me check if this is a bug? thx~
emm, this is not a bug. this will be ok:
x: [String, Number, Array as () => Array<string | number>]
I am experiencing the exact same issue. @fjc0k Can you please point me way out?
@ITsolution-git Sorry, I haven't used vue for a long time. Now, I prefer react, which works better with typescript.
export default Vue.extend({
name: 'WebWhatsNew',
data() {
return {
currentSlide: 0 as number
};
},
methods: {
nextSlide() {
this.currentSlide += 1;
},
},
computed: {
internalOpen: {
get(): boolean {
return this.value;
},
set(val) {
(this as any).$emit('input', false);
},
},
},
});
I get this typing error with the code above.
When I remove
set(val) {
(this as any).$emit('input', false);
},
then the compile error is gone.
Can anyone help
export default Vue.extend({
name: 'WebWhatsNew',
data() {
return {
currentSlide: 0 as number
};
},
methods: {
nextSlide() {
this.currentSlide += 1;
},
},
computed: {
internalOpen: {
get(): boolean {
return this.value;
},
set(val) {
(this as any).$emit('input', false);
},
},
},
});
I get this typing error with the code above.
When I remove
set(val) {
(this as any).$emit('input', false);
},
then the compile error is gone.
Edit: I fixed the issue by set(val
: boolean
)
, adding type to val.
It's my mistake not to add type to val but the lint should give the proper error. However it fixes automatically when you try to fix the other typing issues.
Hope it helps anyone who hits the similar issue.
I have this problem too. Was banging my head on the wall until I read this thread
+1
Most helpful comment
I get this typing error with the code above.

When I remove
then the compile error is gone.
Edit: I fixed the issue by
set(val
: boolean
)
, adding type to val.It's my mistake not to add type to val but the lint should give the proper error. However it fixes automatically when you try to fix the other typing issues.
Hope it helps anyone who hits the similar issue.