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

[TypeScript] Return type for euiSelectableTemplateSitewideFormatOptions #5620

Merged
merged 2 commits into from
Feb 10, 2022

Conversation

thompsongl
Copy link
Contributor

@thompsongl thompsongl commented Feb 10, 2022

Summary

Closes #5616

Adds an explicit return type of EuiSelectableTemplateSitewideOption[] to euiSelectableTemplateSitewideFormatOptions to avoid a verbose inferred type resulting in hundreds of <div> and <li> DOM attributes and event handlers being added to the definition.

This change will eliminate ~600 lines from eui.d.ts

Checklist

  • Checked for breaking changes and labeled appropriately
  • A changelog entry exists and is marked appropriately

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5620/

Copy link
Contributor

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

I need to get better about return typing, if it can reduce inferred types/our eui.d.ts this much 🤯 Any thoughts on whether we should lint for it?

@thompsongl
Copy link
Contributor Author

Any thoughts on whether we should lint for it?

I don't know about linting, but it would be nice to have file or bundle size stats for PRs so we get notified of large increases.

@thompsongl thompsongl merged commit 7f59a7d into elastic:main Feb 10, 2022
@cee-chen
Copy link
Contributor

I just suggested linting because it seemed like an easy way/win to resolve the issue. It looks like we could enable this now: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/explicit-function-return-type.md

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.

[EuiSelectable] Simplify/refactor EuiSelectableOption interface
3 participants