Skip to content

Add missing dictionary and array type hints #106113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2025

Conversation

lodetrick
Copy link
Contributor

Related: #106111, #106087

Adds more type hints that are missing from classes. Type hints for dictionaries and arrays only impact the inspector right now, but have a large impact on usability.

@lodetrick lodetrick requested review from a team as code owners May 5, 2025 23:26
@lodetrick lodetrick changed the title Add dictionary type hints to CodeEdit and SyntaxHighlighter Add missing dictionary and array type hints May 5, 2025
@lodetrick
Copy link
Contributor Author

lodetrick commented May 6, 2025

Interestingly, PROPERTY_HINT_ARRAY_TYPE and PROPERTY_HINT_DICTIONARY hints fails the API check because they have an impact on the API dump, while the PROPERTY_HINT_TYPE_STRING does not. It makes sense that the typed hints should have an impact on the API but currently they are only used in the inspector, the internals primarily use the untyped dictionaries from my knowledge. This also conflicts with how the docs generate types: it currently uses the return type of the getter method.

@lodetrick lodetrick force-pushed the add-dictionary-type-hints branch from fae34d8 to 2f324fe Compare May 6, 2025 00:44
@dalexeev dalexeev added this to the 4.5 milestone May 6, 2025
@lodetrick lodetrick force-pushed the add-dictionary-type-hints branch from 2f324fe to 03c7d4b Compare May 6, 2025 04:25
@lodetrick lodetrick force-pushed the add-dictionary-type-hints branch from 03c7d4b to 093a42e Compare May 6, 2025 15:11
@lodetrick lodetrick force-pushed the add-dictionary-type-hints branch from 093a42e to 247520b Compare May 6, 2025 19:35
Copy link
Member

@KoBeWi KoBeWi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is useful for the inspector, but ideally the properties should be changed to properly use TypedArray/TypedDictionary. It would break compatibility though, so for now adding only hints is fine.

@Repiteo Repiteo merged commit 42b50ab into godotengine:master May 7, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented May 7, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants