I am curious about .d.ts
declaration files because I am new to the TypeScript programming language. I was told by someone that .d.ts
files are are similar to .h
header files in the C & C++ programming languages, however, the .d.ts
files don't seem to work quite the same. Currently, I am failing to understand how to properly use the .d.ts files. It would appear that I cant add my .js
or .ts
files to the .d.ts
files, so the only way my project will work is if it contains all three file types. That seems like a lot of files. To help me better understand how the .d.ts files are related to JavaScript & TypeScript, I have some questions I would like to ask.
What is the relationship between the three files? the relationship between them?
How can I use the
*.d.ts
file? Does it mean I can delete the*.ts
file permanently?If so, how can the
*.d.ts
file know which JS file is mapping to itself?
It would be very nice if someone can give me an example.