BabylonJS / Babylon.js

Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework.
http://www.babylonjs.com
Apache License 2.0
22.77k stars 3.39k forks source link

The example playground from docs doesn't compile in TS #14003

Closed ChromeGG closed 1 year ago

ChromeGG commented 1 year ago

Use Github issues ONLY for bugs validated on the forum first!

We have a really active forum to help answering questions (https://forum.babylonjs.com/)

Repro

Screenshots CleanShot 2023-06-25 at 09 16 14

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context It works for JS. So I guess it's just some typing error

Popov72 commented 1 year ago

It's expected, Mesh.material is of type Material, which does not have a diffuseColor property.

You should do groundMaterial.diffuseColor = BABYLON.Color3.Red(); instead.

ChromeGG commented 1 year ago

@Popov72 Yeah, but then the docs and example should be updated, isn't?

Popov72 commented 1 year ago

I think the docs and examples are in js? Do you have an example of a doc/example that does not work?

ChromeGG commented 1 year ago

This is the example: https://playground.babylonjs.com/#2KRNG9%231 written in JS. Hmm... I thought we should be able to switch from JS to TS w/o errors errors like some field doesn't exist. If TS is raising an errors but JS implementation is fine, then it could be an indicator of not adjusted types.