With type checking set to strict, code such as:
var profile = new Attention.ToneProfile(200, duration * 1000);
Attention.playTone({:toneProfile => [profile]});
results in:
Invalid '$.Toybox.Lang.Dictionary{:toneProfile as $.Toybox.Lang.Array<Any>}' passed as parameter 1 of type 'PolyType<$.Toybox.Attention.Tone or {:repeatCount as $.Toybox.Lang.Number, :toneProfile as $.Toybox.Lang.Array<$.Toybox.Attention.ToneProfile>}>'.
because apparently, contents of arrays are always inferred as Any (?), and it looks like that's not compatible with the signature in strict mode (specifying a :repeatCount
doesn't help).
However, it does not seem possible to be more explicit either:
var profiles as Array<ToneProfile> = new Attention.ToneProfile(200, duration * 1000);
Attention.playTone({:toneProfile => profiles});
results in:
Invalid explicit typing of a local variable. Local variable types are inferred.
So there seems to be no way to make this work. Am I missing something, or is that just not possible?