|
|
|
|
|
by gertop
710 days ago
|
|
You seem confused about what .d.ts files are. They are type definitions to make using JavaScript code in typescript nicer. They're not regular typescript code. Just think if you had to take a big JavaScript library, say the size and level of dynamism of jQuery, and manually write annotations for it yourself. It would indeed take you hours to cover everything. |
|
BTW, jQuery is pretty small. With good lint rules you could probably manually type everything without missing anything in less time than you think. Whatever time is spent doing this manually apparently is worth the cost savings comparing to long compile times if takes more than a few seconds. You only need to write the types once and then again on major refactors. If your builds just take seconds you can run them dozens of times a day. If your compile time is hours then whatever automation you imposed to write your types or d.ts files for you is entirely self-defeating as its costing you dramatically more than just doing it manually one time.
When you have a large project types are written as the code they describe are written, so its little more effort than typing on the keyboard in a separate file.