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

Improve typing of the component API #613

Open
vscav opened this issue Oct 13, 2023 · 0 comments
Open

Improve typing of the component API #613

vscav opened this issue Oct 13, 2023 · 0 comments
Labels
breaking enhancement New feature or request

Comments

@vscav
Copy link
Member

vscav commented Oct 13, 2023

Our official documentation refers to a number type for the value argument (see docs). However, we can in fact support both string and number (and that's what we defined when migrating to TypeScript and helped us figure out the issue - see PR). Plus, the documentation also mentions that the value should be updated using the update function argument, which for now only returns a string.

It seems we have a wobbly API for our component, as it requires us to parse the value returned by the update function before using it to set our new value.

A suggestion could be the following:

interface AmountInputArgs {
  ...
- update: (value: string) => void;
- value: number | string;
+ update: (value: number) => void;
+ value: number;
}

Note that if the suggestion is accepted and implemented, it will be a breaking change.

@vscav vscav added enhancement New feature or request breaking labels Oct 13, 2023
@wandroll wandroll linked a pull request Mar 8, 2024 that will close this issue
@wandroll wandroll closed this as completed Mar 8, 2024
@wandroll wandroll reopened this Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants