Repository navigation
fix(input): string values are emitted - #27226
Merged
Merged
Conversation
|
|
5 of 13 tasks
liamdebeasi
marked this pull request as ready for review
April 18, 2023 12:46
| this.ionInput.emit({ value, event }); | ||
|
|
||
| // Checks for both null and undefined values | ||
| const newValue = value == null ? value : value.toString(); |
Contributor
There was a problem hiding this comment.
The type interface only allows string | null, no undefined, so should we return null instead of value on the left half? Or should the type be updated?
Contributor
Author
There was a problem hiding this comment.
Not sure I understand. The interface for InputInputEventDetail has value?: string | null where the ? indicates the value can be undefined.
Contributor
There was a problem hiding this comment.
Oh, you're right, I missed that 🤪
averyrousseau
approved these changes
Apr 18, 2023
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Apr 18, 2023
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Apr 18, 2023
Issue number: N/A --------- <!-- Please refer to our contributing documentation for any questions on submitting a pull request, or let us know here if you need any help: https://ionicframework.com/docs/building/contributing --> <!-- Some docs updates need to be made in the `ionic-docs` repo, in a separate PR. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation for details. --> <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> The `InputChangeEventDetail` and `InputInputEventDetail` interfaces were updated to add a number type to the value key: #26176 This was done to align with the value property on ion-input which allows for strings and numbers. However, this is incorrect as the value emitted is always forced to a string: https://github.com/ionic-team/ionic-framework/blob/c9bddbdb4cd45fea6a7a57d9427a0294db0b4027/core/src/components/input/input.tsx#L416 We likely copied the the type definition for the `value` prop not realizing that number values are never emitted. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - The `InputChangeEventDetail` and `InputInputEventDetail` interfaces no longer have the `number` type - The value passed to `ionInput` is converted to a string. (This isn't really needed since the native `<input>` element will have a type of string when the user types, but I added it for consistency with the `ionChange` emission). - Added a code comment to highlight this behavior ## Does this introduce a breaking change? - [ ] Yes - [x] No Note: This is not a breaking change because `number` values were never emitted in the first place. <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Apr 18, 2023
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Apr 18, 2023
Issue number: N/A --------- <!-- Please refer to our contributing documentation for any questions on submitting a pull request, or let us know here if you need any help: https://ionicframework.com/docs/building/contributing --> <!-- Some docs updates need to be made in the `ionic-docs` repo, in a separate PR. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation for details. --> <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> The `InputChangeEventDetail` and `InputInputEventDetail` interfaces were updated to add a number type to the value key: #26176 This was done to align with the value property on ion-input which allows for strings and numbers. However, this is incorrect as the value emitted is always forced to a string: https://github.com/ionic-team/ionic-framework/blob/c9bddbdb4cd45fea6a7a57d9427a0294db0b4027/core/src/components/input/input.tsx#L416 We likely copied the the type definition for the `value` prop not realizing that number values are never emitted. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - The `InputChangeEventDetail` and `InputInputEventDetail` interfaces no longer have the `number` type - The value passed to `ionInput` is converted to a string. (This isn't really needed since the native `<input>` element will have a type of string when the user types, but I added it for consistency with the `ionChange` emission). - Added a code comment to highlight this behavior ## Does this introduce a breaking change? - [ ] Yes - [x] No Note: This is not a breaking change because `number` values were never emitted in the first place. <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
liamdebeasi
added a commit
that referenced
this pull request
Apr 19, 2023
Issue number: N/A --------- <!-- Please refer to our contributing documentation for any questions on submitting a pull request, or let us know here if you need any help: https://ionicframework.com/docs/building/contributing --> <!-- Some docs updates need to be made in the `ionic-docs` repo, in a separate PR. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation for details. --> <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> The `InputChangeEventDetail` and `InputInputEventDetail` interfaces were updated to add a number type to the value key: #26176 This was done to align with the value property on ion-input which allows for strings and numbers. However, this is incorrect as the value emitted is always forced to a string: https://github.com/ionic-team/ionic-framework/blob/c9bddbdb4cd45fea6a7a57d9427a0294db0b4027/core/src/components/input/input.tsx#L416 We likely copied the the type definition for the `value` prop not realizing that number values are never emitted. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - The `InputChangeEventDetail` and `InputInputEventDetail` interfaces no longer have the `number` type - The value passed to `ionInput` is converted to a string. (This isn't really needed since the native `<input>` element will have a type of string when the user types, but I added it for consistency with the `ionChange` emission). - Added a code comment to highlight this behavior ## Does this introduce a breaking change? - [ ] Yes - [x] No Note: This is not a breaking change because `number` values were never emitted in the first place. <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue number: N/A
What is the current behavior?
The
InputChangeEventDetailandInputInputEventDetailinterfaces were updated to add a number type to the value key: #26176This was done to align with the value property on ion-input which allows for strings and numbers. However, this is incorrect as the value emitted is always forced to a string:
ionic-framework/core/src/components/input/input.tsx
Line 416 in c9bddbd
We likely copied the the type definition for the
valueprop not realizing that number values are never emitted.What is the new behavior?
InputChangeEventDetailandInputInputEventDetailinterfaces no longer have thenumbertypeionInputis converted to a string. (This isn't really needed since the native<input>element will have a type of string when the user types, but I added it for consistency with theionChangeemission).Does this introduce a breaking change?
Note: This is not a breaking change because
numbervalues were never emitted in the first place.Other information