Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | zhyrin |
In one of my classes, I’ve created a function that returns self.
Does anybody know of a way define the return type with static typing?
I know this can be done if using class_name, but I want to keep the global namespace clean.
# MyClass.gd
extends Node
func self_returning_func(): # -> MyClass
return self
There are issues open about it:
Allow scripts marked with `class_name` to use their class within the script without causing a cyclic dependency · Issue #25252 · godotengine/godot · GitHub
https://github.com/godotengine/godot/issues/21461
It will likely get worked on soon, vnen is now full time on GDScript.
Zylann | 2020-02-18 13:50