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(runtime): narrow onInput & onCapture event types #3135

Merged

Conversation

sean-perkins
Copy link
Contributor

@sean-perkins sean-perkins commented Nov 8, 2021

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally and any changes were pushed
  • Unit tests (npm test) were run locally and passed
  • E2E Tests (npm run test.karma.prod) were run locally and passed
  • Prettier (npm run prettier) was run locally and passed

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

In order to remove the type casting for the ionInput event types, the emitted type for DomAttributes will need to match InputEvent.

GitHub Issue Number: ionic-team/ionic-framework#24111

What is the new behavior?

Libraries/applications using Stencil, will have the input event strongly typed to InputEvent instead of the general Event type.

Does this introduce a breaking change?

  • Yes
  • No

Testing

Other information

@sean-perkins sean-perkins requested a review from a team November 8, 2021 19:54
@rwaskiewicz rwaskiewicz changed the title fix(runtime): onInput event type fix(runtime): narrow onInput & onCapture event types Nov 15, 2021
@rwaskiewicz rwaskiewicz changed the base branch from main to v3.0.0-dev November 15, 2021 13:38
Copy link
Member

@rwaskiewicz rwaskiewicz left a comment

Choose a reason for hiding this comment

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

Thanks!

This change makes sense to me. Since it alters our public API by expecting non-nullable fields on for events:

interface UIEvent extends Event {
    readonly detail: number;
    readonly view: Window | null;
    /** @deprecated */
    readonly which: number;
}

interface InputEvent extends UIEvent {
    readonly data: string | null;
    readonly inputType: string; 
    readonly isComposing: boolean;
}

I'm a tad concerned about breaking changes. I would suspect most folks are using type assertions to trick the compiler, but I can't say for certain that's what's happening. Out of abundance of caution, I'm going to merge this into the v3 branch.

Thanks again!

@rwaskiewicz
Copy link
Member

Gotta fix a small configuration bug for CI to run, hold tight!

@rwaskiewicz rwaskiewicz merged commit 8316a62 into ionic-team:v3.0.0-dev Nov 16, 2021
@rwaskiewicz rwaskiewicz added the Resolution: Refine This PR is marked for Jira refinement. We're not working on it - we're talking it through. label Nov 16, 2021
rwaskiewicz pushed a commit that referenced this pull request Oct 3, 2022
libraries/applications using Stencil, will have the input event
strongly typed to `InputEvent` instead of the general `Event`
type.
rwaskiewicz pushed a commit that referenced this pull request Dec 2, 2022
libraries/applications using Stencil, will have the input event
strongly typed to `InputEvent` instead of the general `Event`
type.
rwaskiewicz pushed a commit that referenced this pull request Dec 5, 2022
libraries/applications using Stencil, will have the input event
strongly typed to `InputEvent` instead of the general `Event`
type.
rwaskiewicz pushed a commit that referenced this pull request Jan 23, 2023
libraries/applications using Stencil, will have the input event
strongly typed to `InputEvent` instead of the general `Event`
type.
rwaskiewicz pushed a commit that referenced this pull request Jan 24, 2023
libraries/applications using Stencil, will have the input event
strongly typed to `InputEvent` instead of the general `Event`
type.
rwaskiewicz pushed a commit that referenced this pull request Jan 24, 2023
libraries/applications using Stencil, will have the input event
strongly typed to `InputEvent` instead of the general `Event`
type.
rwaskiewicz added a commit that referenced this pull request Jan 24, 2023
this commit updates the typings for the analysis task. the team
re-enabled these tasks/tests (for the most part) in #3263.
at the same time, a commit that updates typings for onInput
events was sitting in the v3.0.0-dev branch,
#3135

upon merging main into v3.0.0-dev, the build broke. this commit fixes
the typings to align with the latter commit.
rwaskiewicz pushed a commit that referenced this pull request Jan 25, 2023
libraries/applications using Stencil, will have the input event
strongly typed to `InputEvent` instead of the general `Event`
type.
rwaskiewicz added a commit that referenced this pull request Jan 25, 2023
this commit updates the typings for the analysis task. the team
re-enabled these tasks/tests (for the most part) in #3263.
at the same time, a commit that updates typings for onInput
events was sitting in the v3.0.0-dev branch,
#3135

upon merging main into v3.0.0-dev, the build broke. this commit fixes
the typings to align with the latter commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Refine This PR is marked for Jira refinement. We're not working on it - we're talking it through.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants