.d.ts files are produced by Typescript compiler automatically from .ts files (and can be written manually for .js files). ML signature files are much like .h files and I think for the same reason - to make compiler work easier.
Edit: as this is LLM thread - ML is Meta Language as in OCaml and SML.
Edit: as this is LLM thread - ML is Meta Language as in OCaml and SML.