-
Notifications
You must be signed in to change notification settings - Fork 667
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
setNumLines should take a number #1083
Comments
yes, please! btw -- it'd be very good to eventually expose |
#861 something similar was discussed in regards setNumLines(lines: string | number): this {
this.options.num_lines = Number(lines); |
So why was the method signature assuming string?
I see your comments:
*The group defining @type/vexflow assumed string, wich is wrong, but I
based my initial decision on their guess. However all the instances in this
library use numbers, this is why I had to do string | number. My failure.*
*Once this is ported, @types/vexflow is no longer needed and I believe that
leaving a dual type due to the failure in @types/vexflow and my falure
making it a dual type is not right.*
If true, we should just set it to number. That's the only type that makes
sense really.
If someone out there actually passed a string to setNumLines, I'm okay with
them having to change the code to fix this "breaking change."
…On Thu, Jul 29, 2021, 8:39 PM Rodrigo Vilar ***@***.***> wrote:
#861 <#861> something similar was
discussed in regards getValueForString see the resolved conversations.
I agree that it makes more sense to use number. And I also definetively
forgot to make the approach in #861
<#861> wich would have been.
setNumLines(lines: string | number): this {
this.options.num_lines = Number(lines);
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1083 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAB2MCKNHEQXOIDEOXL4P6LT2INH3ANCNFSM5BHQRCOA>
.
|
I wanted to leave number only, but Mohit prefered to include string should any library user use it so as not to change the interface |
Is there any evidence that people have passed strings to a method called It really does look buggy that My guess is that the original author of setNumLines() figured it would be extra robust to use My vote would be to just change it to number. When we make the next official release, we can bump the version number in a semantic versioning way which suggests breaking changes (e.g., VexFlow 4.0.0). We can also list the known API changes (such as this one) which might break your existing deployment. That way we can fix errors in our API such as this one. |
Hi folks -- Yes, I suggested Now that everything works, as Ron suggested, it's a good opportunity to rationalize the types and maintain a log of interface breaking changes, so we can bump the major version. There's a lot of other calls in the library that do |
Sounds good. We can log breaking changes in a CHANGELOG.md. |
vexflow/src/stave.ts
Lines 187 to 192 in 2315e7a
the line with the parseInt has been in the VexFlow codebase for 5 years.
However, the only tests case that touches the
setNumLines()
is in tabstave_tests.js, and it passes in a number.Can I just change the param's type to number? The
: string
type was added during migration, probably because Rodrigo saw theparseInt()
.The text was updated successfully, but these errors were encountered: