Argument of type '{ shape: any; }' is not assignable to parameter of type 'MatterBodyConfig'

Hey, i’m building a project using phaser 3 and typescript with physics editor, i’m the following error:
Any ideas?
{
“resource”: “Scene.ts”,
“owner”: “typescript”,
“code”: “2345”,
“severity”: 8,
“message”: “Argument of type ‘{ shape: any; }’ is not assignable to parameter of type ‘MatterBodyConfig’.\n Object literal may only specify known properties, and ‘shape’ does not exist in type ‘MatterBodyConfig’.”,
“source”: “ts”,
“startLineNumber”: 56,
“startColumn”: 78,
“endLineNumber”: 56,
“endColumn”: 100
}

HI, I don’t know what are you trying to do in Scene.ts or how are you defining your physics body. But as for the error I guess you are adding a “shape” parameter to a config for a matter body which has no shape parameters…

https://photonstorm.github.io/phaser3-docs/Phaser.Types.Physics.Matter.html

I’m trying to do the following with typescript:

Hi, I see… using shape parameter is not a problem with JS but looks like an issue with Typescript and Phaser as this parameter is missing in the typescript definitions.

What you can do using typescript from my point of view and limited typescript knowledge:

  1. Use any as easy solution
... { shape: shapes.banana } as any
  1. Extend your own type
export type MyMatterBodyConfig = Phaser.Types.Physics.Matter.MatterBodyConfig & {
    shape?: any;
};
... { shape: shapes.banana } as MyMatterBodyConfig

I hope this helps…