Answer the question
In order to leave comments, you need to log in
What's wrong with the void operator?
Promises must be handled appropriately or explicitly marked as ignored with the `void` operator.
167 | methods: {
168 | openUnit(it: string):void {
> 169 | this.$router.push(`/unit/${it}`)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
170 | }
171 | },
172 | async beforeMount():Promise<void> {
Answer the question
In order to leave comments, you need to log in
An ESlint rule that doesn't like floating Promises.
It wants you to do one of the following:
methods: {
openUnit(it: string):void {
void this.$router.push(`/unit/${it}`);
}
}
methods: {
openUnit(it: string) {
return this.$router.push(`/unit/${it}`);
}
}
methods: {
async openUnit(it: string) {
await this.$router.push(`/unit/${it}`);
}
}
He wants you to write like this:
void this.$router.push(`/unit/${it}`);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question