I have the following problem: within the following code, I'm trying to check, if the variable result is true or false:
const result: boolean = await this.sqlConnector.validatePassword
(this.userData.getUserId(), validatorContext.recognized.value);
// Returns string
console.log(typeof(result));
The function sqlconnector.validatePassword is also returning a boolean. The header of the function looks like that:
public validatePassword (userId: string, userInput: string): Promise <boolean>
However, the typeof(result) function is saying, that the variable is from type string.
This finally leads to the fact that the following if statement always fails.
// always false because no boolean
if (result === true) {
return true;
} else {
What is the reason for this?
resultas aboolean.string, you'll get a string, despitebooleanannotation in TS code.result[0].isSecretCorrectis actually astringat the moment, when it passes to theresfunction.