Incorrect or Inconsistent Typescript Definitions

Hi,

I’m using babylon 6 with typescript in vscode (es6). The problem also appears on the playground.

The problem at hand is the MeshBuilder.CreateLineSystem method that accepts as its final argument a Scene instance. In this playground example, the scene argument is omitted when updating the mesh. However, when switching to typescript, the scene argument is annotated as non-optional, thus producing an error in the editor window. The transpiled Javascript code runs fine, so this is really just an issue with the type definitions.

While investigating, I also stumbled upon a similar issue with the HemisphericLight constructor (as it also appears in the playground example). There might be multiple instances of this but I do not have the time to find all of them.

Hi @mystery-e204 and welcome to the forum

I think @RaananW has experience with TS definition

The scene at the end of these functions (or many other classes’ constructors) is optional for quite some time, but we might have missed a few in regard to setting them optional in typescript. I will be happy to review a PR, if you want to fix it yourself, otherwise - i’ll look into that later and fix it.

2 Likes

Thank you for the quick response! Unfortunately, I am still not particularly familiar with Typescript, so I won’t open a PR myself. Thanks for looking into it.

1 Like

will be fixed in an upcoming PR. thanks again for reporting :slight_smile:

1 Like