Godot Version
4.3
(Google translator)
As far as I know, you can’t use null with typing, it’s a limitation of GDScript. A null has no type.
If you want to return null, you have to remove “-> Dictionary”.
The other option is to return a data type of your own, Dictionary, that represents a null, it would make little sense (If, for example, your method returned
an enumeration you could return MyEnumeration.NULL to represent your null).
Yes, Dictionary
type can’t be a null
. You can maybe retrieve an empty Dictionary?
return {}