I have the following class declared:
class MyClass {
private myValue!: string
constructor(){
this.mySettingFunction()
}
public mySettingFunction(){
// do stuff
this.myValue = 'something'
}
}
In this class, I'm using the definite assignment assertion(!) on myValue to tell typescript that the value will be initialized despite it not being able to "understand" it.
However, I was guessing, is there a way to tell typescript that mySettingFunction will initialize myValue? (Like an annotation or something similar that allows me to remove the ! from myValue)
constructorstraight away?constructorandmySettingFunction.