Problem with advancedTexture.addControl() in TypeScript

Hey guys,
I am really confused with this simple task here: :woozy_face:

You may all know our PG for creating a Textblock (BABYLON.GUI) in JavaScript:
https://www.babylonjs-playground.com/#XCPP9Y#2

I used a TypeScript Version like this in a lot of PGs before:
https://www.babylonjs-playground.com/#0D50YC

The addControl()-Method expects a BABYLON.GUI.Control Type…which is BABYLON.GUI.Rectangle, but it does not work…even casting it like <BABYLON.GUI.Control> shows no results!
Have seen this issue some month ago in an other project where the PG was complaining but still took my parameters…but now I am stuck…even with other examples that worked before.

Argument of type ‘TextBlock’ is not assignable to parameter of type ‘Control’.
Types have separate declarations of a private property ‘_draw’.

and if I cast:

Conversion of type ‘TextBlock’ to type ‘Control’ may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to ‘unknown’ first.
Types have separate declarations of a private property ‘_draw’.

any ideas?:sweat_smile:

Yep this is interesting. The playground is far more strict that our build env. I will fix that asap!

1 Like