Here is my component setup:
interface Data {
selectedOption: string;
}
@Component({
})
export default class OptionSelector extends Vue {
public data(): Data {
return {
selectedOption: 'None',
};
}
public updateOption() {
this.$data.selectedOption = '';
}
}
Everything seems to be working fine, but the type of this.$data.selectedOption
is showing as any
instead of string
even though I specified the return type in the data()
method. I have tried moving the data()
method inside @Component({})
but it did not solve the issue. I also tried using this.selectedOption
instead but it did not compile.
Is there a method to ensure proper typing for the data
object?