Acknowledged

Disable type checking for generated code and third party lib

Hi,

I like the type checked, it gives me a secure feeling for my code, it even helped me already to spot a potential bug.

However the type checke also checks code which I did not write. The Rez file is checked and as well an included 3 party barrel file:

ERROR: venu2plus: /private/var/folders/vw/l94k19_d2_q_hrvx1727y1sr0000gn/T/kpay-app.barrel15021388383397124352/content/source/app-kpay.mc:414,10: Invalid '$.Toybox.Lang.Method(responseCode as Any, data as Any) as Any' 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)>'.

ERROR: venu2plus: /private/var/folders/vw/l94k19_d2_q_hrvx1727y1sr0000gn/T/kpay-app.barrel15021388383397124352/content/source/app-kpay.mc:463,16: Invalid '$.Toybox.Lang.Method() as Any' passed as parameter 1 of type '$.Toybox.Lang.Method() as Void'.

ERROR: venu2plus: /private/var/folders/vw/l94k19_d2_q_hrvx1727y1sr0000gn/T/kpay-app.barrel15021388383397124352/content/source/app-kpay.mc:476,12: Invalid '$.Toybox.Lang.Method() as Any' passed as parameter 1 of type '$.Toybox.Lang.Method() as Void'.

ERROR: venu2plus: Rez.mc:32,12: Invalid '$.Toybox.Lang.Dictionary{:title as Null}' passed as parameter 1 of type 'PolyType<Null or {:title as $.Toybox.Lang.String or $.Toybox.Lang.Symbol or $.Toybox.WatchUi.Drawable, :focus as $.Toybox.Lang.Number}>'.

ERROR: venu2plus: Rez.mc:34,12: Invalid '$.Toybox.Lang.Symbol' passed as parameter 1 of type '$.Toybox.Lang.String'.

ERROR: venu2plus: Rez.mc:49,12: Invalid '$.Toybox.Lang.Dictionary{:title as Null}' passed as parameter 1 of type 'PolyType<Null or {:title as $.Toybox.Lang.String or $.Toybox.Lang.Symbol or $.Toybox.WatchUi.Drawable, :focus as $.Toybox.Lang.Number}>'.

ERROR: venu2plus: Rez.mc:54,12: Invalid '$.Toybox.Lang.Symbol' passed as parameter 1 of type '$.Toybox.Lang.String'.

 

I wonder if the type checker could ignore those files, or at least accept a command line argument with the files/directory that should be verified.

  • Looks like you have two options. 

    -Wait for the kpay folks to make their code "type check friendly". A barrel is really just a zip file, so you can unzip it and do the changes to the files yourself

    -Turn off type checking.  You can do it just for a single app by putting this in the monkey.jungle file for your app:

    project.typecheck = 0