diff --git a/automated_updates_data.json b/automated_updates_data.json index 8a7b974c5c..6aba56f63f 100644 --- a/automated_updates_data.json +++ b/automated_updates_data.json @@ -1,5 +1,5 @@ { - "last_automated_updates_commit": "50afd05049bc87c288dc4c7ccbce55388522fe53", + "last_automated_updates_commit": "0a20f7194b1de1fd11d3981865ce502a3db7ac5a", "last_improved_things": [ { "date": "2026-02-16", diff --git a/docs/gdevelop5/events/js-code/index.md b/docs/gdevelop5/events/js-code/index.md index 76534ffa5c..674a2afbd1 100644 --- a/docs/gdevelop5/events/js-code/index.md +++ b/docs/gdevelop5/events/js-code/index.md @@ -101,6 +101,10 @@ Equivalent events would be: By writing the **annotation** `/** @type {gdjs.XXX} */` just before the declaration of a variable in JavaScript, you let the code editor know that the variable has the type gdjs.XXX. The editor will be able to assist you by providing **autocompletion** while you type (or when you hover over a word). +!!! tip + + You can enable **type error highlighting** in the JavaScript code editor. Go to **Preferences** and turn on the option to display type errors in JavaScript events. When enabled, the editor will underline type mismatches and other issues directly in your code. + Most of the time annotations are not needed. The methods that you are using are already setup with type annotations. But when you use a list of objects, you may want to access this object specific method (for example, methods to modify the animation of a sprite object). In this case, you could write `/** @type {gdjs.SpriteRuntimeObject} */`. If you don't do this, the code will still work, but the editor will only be able to provide you with the methods of [gdjs.RuntimeObject](https://docs.gdevelop.io/GDJS%20Runtime%20Documentation/classes/gdjs.RuntimeObject.html) (the base class).