declare module
should typically be avoided.
Instead, the file itself should be used as the declaration for the module.
TypeScript uses module resolution to determine what files are associated with what modules.
Bad:
declare module "mylib" {
function foo(): number;
}
Good:
export function foo(): number;