How to disable new 4.3 inferred types and auto-formatting?

Godot Version

4.3.stable

Question

Prior to 4.3, when dragging a child node into the script editor, it would look something like this:
@onready var score_label = $ScoreLabel
Now, it looks like this:
@onready var score_label: Label = $ScoreLabel

Also, when auto-filling suggested things via the drop-downs that appear when typing, sometimes additional words like “void” are showing up now.
Old:
func _process(delta):
New:
func _process(delta: float) -> void:

This is just a couple of examples that I’ve noticed, but there’s definitely more. I’m sure this is a great addition for many people, but I don’t understand why it is the default now. Like, is it actually necessary? My other code doesn’t have all this, and it works fine. I don’t see the point of needing to tell the script what node type a child is if the engine already controls that, it seems like overdefining things. I don’t really know what “void” means to be totally honest, but delta is essentially always a float, so why is “float” there?

I’m not a fan of having inconsistencies with my code, and I don’t feel like going back thru it all to add this to what already exists. Can I turn all this off somehow?

Type hints can greatly increase GDScript speed, improve auto-complete, and produce safer code. It’s a good default for those reasons, and you can disable the automatic additions in your editor settings “text_editor/completion/add_type_hints”

1 Like

Thank you! Here it is for any future viewers.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.