I am trying to convert a string to boolean. There are several ways of doing it one way is
let input = "true";
let boolVar = (input === 'true');
The problem here is that I have to validate input if it is true or false. Instead of validating first input and then do the conversion is there any more elegant way?
In .NET we have bool.TryParse which returns false if the string is not valid. Is there any equivalent in typescript?