I am trying to define variables but it does not initialize them and I am already using them, how do I solve this problem? it only solves the problem for me by adding "!" as if it were a denial, I do not know if that is the solution I attach evidence
By adding the symbol ! are you telling typeScript that this variable will have a value or is underfined email!: stringbecause you didn't give this variable a value typeScript catches the error before execution and won't let you unless you tell it toemail!: string o email: string | underfined
Always initialize variables => email:String = ""; <= empty string, or you can => email:String = "[email protected]";
You can use this syntax
Then you can assign the value in the component lifecycle that you need
By adding the symbol ! are you telling typeScript that this variable will have a value or is underfined
email!: string
because you didn't give this variable a value typeScript catches the error before execution and won't let you unless you tell it toemail!: string o email: string | underfined