Declaration file

The layout of your declaration files should mirror the layout of the library.
A library can consist of multiple modules.

Your declaration files should thus be
@types/myLib +---- index.d.ts +---- foo.d.ts +---- bar +---- index.d.ts +---- baz.d.ts

Recommend you:

  1. Create a new file in the root of your source tree: [libname].d.ts
  2. Add declare module “[libname]” { }
  3. Add the template inside the braces of the declare module, and see where your usage breaks