title: How to implement declaration .d.ts file in Typescript
body: <p>I found a lot of literature on what the declaration <code>.d.ts</code> files are, but not on how to implement them. I understood that they can be auto-generated with the typescript compiler.</p>
  <p>So my questions are:</p>
  <ul>
  <li><p>when should I write the <code>.d.ts</code> file my own, and when should I autogenerate them?</p>
  </li>
  <li><p>what happen if I write my own <code>.d.ts</code> files and then also autogenerate them with the compiler?</p>
  </li>
  <li><p>should I write a <code>.d.ts</code> file for every <code>.ts</code> file or only to what I will expose as API of my library?</p>
  </li>
  </ul>
  <p>Thank you</p>