Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion automated_updates_data.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"last_automated_updates_commit": "50afd05049bc87c288dc4c7ccbce55388522fe53",
"last_automated_updates_commit": "0a20f7194b1de1fd11d3981865ce502a3db7ac5a",
"last_improved_things": [
{
"date": "2026-02-16",
Expand Down
4 changes: 4 additions & 0 deletions docs/gdevelop5/events/js-code/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down