Skip to content
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

Added @generic T to the methods that returns the passed component t… #251

Open
wants to merge 5 commits into
base: update
Choose a base branch
from

Conversation

astrochili
Copy link
Contributor

@astrochili astrochili commented Dec 12, 2023

Added the generic type T to the annotations to avoid type loss during the component instance creating.

Example of the solved problem:

-- some component
---@class pocket_view: druid.base_component
...
-- some class property
---@field pocket_view pocket_view
...
-- assigning
self.pocket_view = self.druid:new(PocketView, 'pocket')
-- Warning that the returned class druid.base_component is not the expected pocket_view
...

@Insality
Copy link
Owner

Thanks for contribution!

Since the annotations.lua is generated file, I will update the source code to able generate the same thing. It seems very useful!

@Insality Insality self-assigned this Jan 26, 2024
@Insality Insality added the documentation Update documentation label Jan 26, 2024
@Insality Insality added this to the 0.12.0 milestone Jan 26, 2024
@Insality Insality changed the base branch from develop to update August 27, 2024 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Update documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants