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

fix: add return types to forwardRef for IntelliJ completion #166

Closed
wants to merge 1 commit into from

Conversation

web-padawan
Copy link
Member

Description

Fixes #165

Added type cast to components using forwardRef similar to how it's done in other cases, especially Notification and components with generics e.g. Grid. This is a workaround for the IntelliJ bug related to ForwardRefExoticComponent.

Note: I also had to add special helper to omit properties starting with underscore using TS template literal types.
Otherwise, code completion popup for DateTimePicker, Select and TimePicker would look like this:

Screenshot 2023-12-08 at 10 22 53

There is no need to use this for ContextMenu and Dialog as they don't expose protected properties.

Type of change

  • Bugfix

Copy link
Member

Choose a reason for hiding this comment

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

For some reason, I still see a very limited list of options for these components on IntelliJ:

Screenshot 2023-12-08 at 16 14 32

Copy link
Member Author

Choose a reason for hiding this comment

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

How did you test it? I was copying the .d.ts file and for me it worked:

Screenshot 2023-12-08 at 16 43 27

Copy link
Member

Choose a reason for hiding this comment

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

I used npm link @hilla/react-components on docs

Copy link
Member Author

Choose a reason for hiding this comment

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

Using npm link for me makes code completion popup not show at all (IntelliJ 2022.2.5). Will try latest IDEA.

@web-padawan
Copy link
Member Author

Closing in favor of #167 which resolves the original issue in the latest version of IntelliJ IDEA.

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

Successfully merging this pull request may close these issues.

Some components are not resolved in IntelliJ and code completion not shown
2 participants