Closed KarlPurk closed 8 years ago
Cool. That is pretty sweet. Thank you!
I don't have a TypeScript setup here yet, so I'll trust you. How about we name it must.d.ts
to match the main file and I'll get it out there.
Do you have any idea how to autogenerate it for the future based on JSDocs, too?
I've renamed the definition file to must.d.ts
.
I've not really looked into auto generating a definition file but a quick google reveals a stack overflow post with some potential leads: http://stackoverflow.com/questions/18301898/generating-typescript-declaration-files-from-javascript
If I find myself with some spare time I'll look into further.
Thanks again, Karl! I'll cut a release in the morning.
A quick Q: The TypeScript compiler picks up the definitions automatically now that there's the typings
package.json
property, right?
And does the global declaration need one for Object
, too, or is that somehow implied?
No problem Andri!
A quick Q: The TypeScript compiler picks up the definitions automatically now that there's the typings package.json property, right?
Yes, that's correct.
And does the global declaration need one for Object, too, or is that somehow implied?
Yes, it does, well spotted :) I can submit a patch for this if you want?
I'm going to look into testing definition files soon, when I do, I can create a set of tests to validate the definitions if you'd be happy accepting them?
Looking forward to the next release!
Yes, it does, well spotted :) I can submit a patch for this if you want?
That'd be lovely. Thanks! You've got your [repo] mirror set up already, so go ahead, let me know and I'll pull from that.
This PR adds a first attempt at a typescript definition file. This has been created by hand, perhaps auto-generation would be a better solution as mentioned in #37.
I've followed the recommended approach of using the documentation to drive the creation of the definition file. Some errors may have slipped through, a review of the annotations would be a good idea.
I've added support for the following primitive types
string
,boolean
,number
andarray
, enabling the following:This would benefit from some tests to verify the definition matches the expected API. However, I've not looked into testing definition files yet. Fixes #37.