As a beginner in question writing, I apologize if my wording is not clear.
The issue at hand: I am working on a Vue application with TypeScript.
export default {
methods: {
setProgram: (program: Program)=>{
this.program = program // TS2532: Object is possibly 'undefined'.
this.step++ // TS2532: Object is possibly 'undefined'.
}
},
...
}
While I appreciate the safety net provided by TypeScript, I am confident that "this" will not be undefined in this scenario.
How can I reassure TypeScript about using "this" in this context?
I appreciate any help, have a wonderful day!
Sincerely, Dom.