mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-28 17:02:24 -05:00
bbd65324bc
This add a gulp task (`gulp docs:typescript`) to automatically generate a typescript definition for the library. This should solve the problem of having an out of sync type definition when we change the API. This task takes advantage of existing JSDoc parsing to generate a temporary file which is later formatted through a mustache template to generate the final definition. This definition is then tested by compiling a typescript file that use it. The generated definition is added to the `gulp zip` task in order to be published along with the bundled library. So 2 new dev-dependencies are added with this change: `mustache` and `typescript` packages. Using node and mustache to generate the definition instead of relying on existing templating system is motivated by a better development experience, with easier debugging possibilities... through the usage of more modern tools. As a side note, support of "rest parameters" (when a parameter can be present multiple times) is added to existing JSDoc parser in order to support this pattern on typescript side (E.g. for `Color#set()` method which accept any sequence of parameters that is supported by `Color` constructors). |
||
---|---|---|
.. | ||
jsdoc@da249447ca | ||
tasks | ||
typescript | ||
utils |