Refactor function to return same type

Hi I have pieces of code Where in a function is exported as a module and inside it we are validating some conditions.

return true;
return 'message'

This gives off as error in sonar to return same type. I can’t return an array like return [false,'message] as it would require change in 100s of files in repo.
Is there some other way to do this. Also the caller function uses inquirer.prompt and validate method of this requires you to return this way.

Hey there.

I’ve moved your post to a category where you can report false-positives. Feel free to update your post with the information asked for: