title: How to make request body type compatible with RequestInit or BodyInit when using node-fetch?
body: <p>I started to use Typescript for my nodejs project. For accessing some external API, I use node-fetch to make requests. While setting up a PUT request, an error pops up, saying that the given body is not assignable to type <code>RequestInit</code>:</p>
  
  <p>The error:</p>
  
  <pre><code>Error:(176, 28) TS2345:Argument of type '{ headers: Headers; method: string; body: MyClass; }' is not assignable to parameter of type 'RequestInit'.
    Types of property 'body' are incompatible.
      Type 'MyClass' is not assignable to type 'BodyInit'.
        Type 'MyClass' is not assignable to type 'ReadableStream'.
          Property 'readable' is missing in type 'MyClass'.
  </code></pre>
  
  <p>MyClass:</p>
  
  <pre><code>class MyClass {
    configId: string;
    adapterType: string;
    address: string;
  
    constructor(configId: string, adapterType: string, address: string) {
      this.configId = configId;
      this.adapterType = adapterType;
      this.address = address;
    }
  
    // some methods
  }
  </code></pre>
  
  <p>Invocation:</p>
  
  <pre><code>let body = new MyClass("a", "b", "c")
  let url = config.url + "/dialog/" + dialogId
  let headers = new Headers()
  // Append several headers
  
  let params = {
    headers: headers,
    method: "PUT",
    body: body
  }
  
  return new Promise((resolve, reject) =&gt; {
    Fetch(url, params) // &lt;-- error is shown for params variable
      .then(res =&gt; {
        // Do stuff
        resolve(/*somevalue*/)
      })
  }
  </code></pre>
  
  <p>How should I make the body object compatible?</p>