Error TS2345

Hi,

I am trying to generate one POST request to service, and i am having troubles with scheme.
Last time, i wrote one post about that, and i successfully create one request,but without "array", and now i put array inside and i cannot build code.

Also i check few topics on forum about this code, and i delete node_modules folder, but no success.

Here are screenshots, so if someone can help i would appreciate your help.

Thank You :slight_smile:

This is request i want to post:

{started:"2019-12-12T00:00:00",finished:"2019-12-12T00:00:00",warehouseId:4,note:"note",items:[{productBarcode:"12345",productName:"Box",unitOfMeasure:"KG",quantity:"12"}]}

Hi @Veljko_Dudukovic,

Check the generated code. The TypeScript compiler says that the value provided for the parameter does not match the type you have specified.

Hi @korchev,

I checked generated code, but i cannot see the difference...

Example, this is working (without items array)

There seems to be a glitch and the items property isn't generated in the XXX.model.ts file. As a workaround you can add that file to the code generation ignore list and manually add the items property:

interface Inventory
{
    /* other properties */
    items: InventoryItems[];
}
1 Like

@korchev,

Thank You very much !
I put model file on ignore list, add item: InventoryItems[]; and now is good !

Thanks thanks thanks!