Godot Version
4.1.3 stable
Question
Is it posible to declare Dictionary key and value types?
Not yet
Type erasure on dictionaries destroys a large part of their purpose. This would be a great feature.
Btw this is already implemented in 4.4 dev 2 and up
Yes.
I opened a bug for a minor problem with them in the editor (4.4. dev3). Resolved quickly.
Seriously awesome thank you! Saved me from having to refactor all my control logic. Once Dictionary typing gets released in standard versioning how difficult/is it possible to switch my project off the dev branch and back to stable?
Technically will require minor adjusts, they always try to keep the compatibility between releases so you probably will not find big problems to upgrade, just do a backup of your project and be happy
For anyone who finds this off Google, you can now do
@export var typed_key_value: Dictionary[int, String] = { 1: "first value", 2: "second value", 3: "etc" }