Home > OS >  Function lacks ending return statement and return type does not include 'undefined'.ts(236
Function lacks ending return statement and return type does not include 'undefined'.ts(236

Time:10-27

I need help with this error, I don't know how to correct or fix it

enter image description here

CodePudding user response:

Not all paths are returning a string. Or you need to declare the type of your function as string | void or you need to add return ''; at the end of your function. Should do the trick!

CodePudding user response:

You got this error because you miss the else condition.

if(respuesta === this.opcionSeleccionada){
    return 'active text-light';
}else{
    //Here you need to return something.
} 
  • Related