Skip to content

Commit 1335f38

Browse files
authored
Merge pull request #10781 from Lexyth/patch-3
Clarify type-safety of as
2 parents 7329907 + 571a85d commit 1335f38

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tutorials/scripting/gdscript/gdscript_styleguide.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,11 @@ that type will be used to infer the type of the var.
10601060
@onready var health_bar := get_node("UI/LifeBar") as ProgressBar
10611061
# health_bar will be typed as ProgressBar
10621062

1063-
This option is also considered more :ref:`type-safe<doc_gdscript_static_typing_safe_lines>` than the first.
1063+
1064+
.. note::
1065+
1066+
This option is considered more :ref:`type-safe<doc_gdscript_static_typing_safe_lines>` than type hints,
1067+
but also less null-safe as it silently casts the variable to ``null`` in case of a type mismatch at runtime,
1068+
without an error/warning.
10641069

10651070

0 commit comments

Comments
 (0)