title: Convert string to object in typescript?
body: <p>I am trying to validate a glob expression using <a href="https://github.com/micromatch/is-valid-glob" rel="nofollow noreferrer">Is-Valid-Glob</a> which accepts string and array. The value which needs to be validated is received from a text field. The problem is that if we pass an invalid glob expression it produces the wrong result as every input is received as a string. For example:- If user inputs [] (invalid glob) its gets assigned to model variable as string '[]' and validation is done on '[]' instead of [] value.
  Is there a way by which we convert the value from string variable to object variable (only the value should not get type) and do validation?</p>
  <p>PS: I am using Angular 2.</p>