Typescript playground behaviour changed

Hi,

I am using playground with typescript for longer time and now I have from day to day many errors reported. Its related to math and material function (specularColor???) that used to be working, can you look at it?
https://www.babylonjs-playground.com/#TH4EE8#2 (example lower)

second question (its not an real error) is that approach to load external scripts from js is not working in TS. Is there any approach to get this working on TS? (example lower)
https://www.babylonjs-playground.com/#WF3VKZ

Thank you!
Jan

According to Babylon docs, specularColor, diffuseColor don’t exist on Material. You can fin them on SimpleMaterial, for eg.

Regarding Math, it must be because window.Math is overriden by another Math type. Try:

declare var window: any;

at the top of the script, and use window.Math instead of Math.

For the second part, it works even if you get errors, as the typescript code will still be converted to js code even if there are errors. If you want to get rid of errors, add at the beginning of the script:

declare var document: any;
declare var showAxis: any;

… and welcome to the forum!

1 Like

I will fix the problem with Math not being found :slight_smile:

Thank you for quick reply and working solution!