Start a new topic

error: Argument of type 'number' is not assignable to parameter of type 'Int32'

 I Create a TypeScriptHtmlApp Project In Visual Studio, and I write the following code in app.ts, an error occured when calling test1.Add(1, "test1");

var test1 = new (System.Collections.Generic.Dictionary$2(System.Int32, String).ctor)();
test1.Add(1, "test1"));
test1[1] = "test1";
test1[2] = "test2";

 


error TS2345: Build: Argument of type 'number' is not assignable to parameter of type 'Int32'.

1 Comment

We fixed that in DuoCode 1.4.

As a workaround currently use Number instead of System.Int32 or alternatively put these lines in your .ts file:

interface Number extends System.Double {

}

Login or Signup to post a comment