The TypeScript code here:
let button = BABYLON.GUI.Button.CreateSimpleButton("test", "click");
button.setPaddingInPixels(4);
causes this TSC TypeScript error:
error TS2551: Property 'setPaddingInPixels' does not exist on type 'Button'. Did you mean 'paddingTopInPixels'?
The code works correctly in JavaScript but it errors in TypeScript. Is the method not defined in TypeScript?
Thanks,
Michael
Michael_Scherotter:
setPaddingInPixels
Can you repro in the playground (on TS side of course)?
Yes - the API isn’t in 4.2 - which is the version I’m using.
Strange because the code works in JavaScript for me but fails in Typescript.
https://www.babylonjs-playground.com/#H9EEA8
Are you sure you are not referencing 5.0 (from the preview cdn?)
My web page references https://cdn.babylonjs.com/babylon.js
And my package.json includes these dependencies:
“babylonjs”: “^4.2.0”,
“babylonjs-gui”: “^4.2.0”,
“babylonjs-materials”: “^4.2.0”,
Michael
It does not work in a JS playground when you switch to 4.2: Babylon.js Playground