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

Add TypeScript definition for change event [⏳ 1d] #3040

Closed
web-padawan opened this issue Nov 15, 2021 · 0 comments · Fixed by #3085
Closed

Add TypeScript definition for change event [⏳ 1d] #3040

web-padawan opened this issue Nov 15, 2021 · 0 comments · Fixed by #3085
Labels
enhancement New feature or request typescript TypeScript definitions issue

Comments

@web-padawan
Copy link
Member

Motivation

Background: https://vaadin.slack.com/archives/D7V9RRY11/p1636969267000200

As a Lit + TypeScript user, when using Vaadin field components e.g.

<vaadin-combo-box @change=${this.fontFamilyChanged}>

... I would like get the value of the combo box without a type cast:

private fontFamilyChanged(event: Event) {
  const combo = event.target as ComboBox;
}

Proposed solution

Investigate if we could add change to ComboBoxEventMap to get this:

private fontFamilyChanged(event: ComboBoxChangeEvent) {
  const combo = event.target; // no type case needed
}

Note

Two last examples here might be useful: https://freshman.tech/snippets/typescript/fix-value-not-exist-eventtarget/

@web-padawan web-padawan added enhancement New feature or request needs research More information needed to estimate typescript TypeScript definitions issue labels Nov 15, 2021
@web-padawan web-padawan removed the needs research More information needed to estimate label Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request typescript TypeScript definitions issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant