I am a beginner in TypeScript. I have encountered an issue with the code below, which runs perfectly fine in JavaScript but is not compiling here.
export default {
data: function() {
return {
data: [
'Angular',
'Angular 2',
'Aurelia',
'Backbone',
'Ember',
'jQuery',
'Meteor',
'Node.js',
'Polymer',
'React',
'RxJS',
'Vue.js'
],
name: "",
selected: null,
hasVariationRadio: ""
};
},
computed: {
filteredDataArray(): [] {
return this.data.filter((option: string) => { // This is where the error appears
return option
.toString()
.toLowerCase()
.indexOf(this.name.toLowerCase()) >= 0 // Also here.
})
}
}
};
The error message I'm receiving is:
Property 'name' does not exist on type '{ filteredDataArray(): []; }'.
I have set strict to true
in the tsconfig.json
file as mentioned on the Vue.js documentation website.