Manually writing .d.ts files is typically only necessary when working with existing .js files. If you're developing a TypeScript project, it's recommended not to write .d.ts files by hand, as the compiler with the --declaration option can auto-generate them.
In a recent discussion on the topic (link here), I referenced the manual .d.ts file for microsoft/vscode as an example. Despite this project being written in TypeScript, the vscode development team chose this unconventional approach for API declaration. It raises the question of the rationale behind their decision to manually write the .d.ts file instead of generating it from the source code.