I'm trying to add Type annotations to an existing app, and I'm hitting a wall on the code which downloads Workouts as PersistedContent
I'm using makeWebRequest, but the callback does not appear to have Iterator in its PolyType signature:
var options = {
:method => Communications.HTTP_REQUEST_METHOD_GET,
:headers => {
"Authorization" => "Bearer " + mModel.accessToken,
},
:responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_FIT,
};
Communications.makeWebRequest(
url,
setupParams(),
options,
method(:onDownloadWorkoutResponse)
);
function onDownloadWorkoutResponse(
responseCode as Number,
downloads as Iterator?
) as Void {
...
}
Gives the error:
Invalid '$.Toybox.Lang.Method(responseCode as $.Toybox.Lang.Number, downloads as Null or $.Toybox.PersistedContent.Iterator) as Void' passed as parameter 4 of type 'PolyType<(callback(responseCode as $.Toybox.Lang.Number, data as Null or $.Toybox.Lang.Dictionary or $.Toybox.Lang.String) as Void) or (callback(responseCode as $.Toybox.Lang.Number, data as Null or $.Toybox.Lang.Dictionary or $.Toybox.Lang.String, context as $.Toybox.Lang.Object) as Void)>'.
Thanks