title: Argument of type 'unknown' is not assignable to parameter of type 'string'. While trying to implement json parse in typescript
body: <p>I am implementing this code from node js to typescript and I am having the  following error</p>
  
  <pre><code>const StringPath:string = "../PathtoJson.json";
  
  export class ClassName
  {   
      name:string;
      constructor(name:string) {
          this.name = name;
      }
      loadn(filename:string) 
      {
          return new Promise((resolve, reject) =&gt; {
              let fs = require('fs');
                  fs.readFile(filename, function (err:Error, data:any) 
                  {
                      if (err) 
                      {
                          console.log(err);
                          reject();
                          throw err;   
                      }
                      let gg = JSON.parse(data);
                      resolve(data);
                  });
              });
      }
  }
  let jsh = new ClassName("A string");
  let  test = jsh.loadn(StringPath).then((result) =&gt; {
      test = JSON.parse(result); // here happens the error
      //return JSON.parse(result); // the same error happens here to
  });
  
  </code></pre>
  
  <p>Error:
  (parameter) result: unknown</p>
  
  <p>Argument of type 'unknown' is not assignable to parameter of type 'string'</p>