-
Notifications
You must be signed in to change notification settings - Fork 115
Description
As someone planning to use xAPI from Typescript code, it would be great if TinCanJS had javascript typings to assist with auto-complete and type-checking, but if type definitions exist I cannot find any.
The generated documentation seems like it would go a pretty long way towards this, if there was a way to automate the conversion of the annotation comments into Typescript definitions (I'm not aware of any). There are also some holes in the documentation. (e.g. a lot of places in the doc specify a callback just as type function without further specifying the type of the function, so i either need to guess or refer to the code). Typescript allows specifying the type of a function, which makes sure that the calling code is passing in the right kind of a callback.
I'm currently bridging the gap by writing some of my own type definitions just for parts of the xAPI that I need, e.g.
interface TinCanRetrieveActivityProfileConfig {
activity: TinCanActivity;
callback: (err,activityProfile:TinCanActivityProfile)=>void
}
interface TinCanLRS {
retrieveActivityProfile(key:string, cfg:TinCanRetrieveActivityProfileConfig)
...
}