-
-
Notifications
You must be signed in to change notification settings - Fork 316
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
breaking typing changes in v4.3.0 #612
Comments
We're glad you find this project helpful. We'll try to address this issue ASAP. You can vist https://solothought.com to know recent features. Don't forget to star this repo. |
I also hit this problem and I have to resort to But the problem is I am not sure where the xml string contains a specfic tag or not, so the code |
@qiulang maybe you can try |
I merged the PR without thinking other negative possible cases. I believe I should have some tests to check the typings. Anyway, I'm planning to revert this change as warning is better than error. |
@amitguptagwl if we decide to use
I really don't think that adds much value (or "safety") to just And the SO discussion How do you validate properties on an But that is just my opinion. |
let me first revert the changes. and discuss for the right solution before applying change |
This project constantly has breaking type changes in patch and minor versions. Are there any plans to review type changes before releasing? |
Reporting the issue and providing suggestions is probably what we can do best. |
@jdforsythe This was the 2nd incident happened this year related to typings. If you want to highlight anything particular, it would be helpful. |
@amitguptagwl I went back through our PRs and I see 6 breaking changes since 4.0.0 - the changes we had to make are listed below:
So to be fair, there have been only 2 truly typing-based breaking changes - the rest have been actual breaking changes in the code for non-major version bumps. I'd be happy to work on it with you. |
Thanks for your kindness. Did you mean to say that a new feature should not be added as minor version even if it is not a breaking change? |
I want to be as accurate as possible - I'll show the example of adding Here's the commit adding that option: From a Javascript perspective, this looks like it should have been a minor version bump - since it's adding a new feature, but the default behavior stays the same and doesn't break existing code. From a TypeScript perspective, this was a breaking change. 6ad40ee#diff-7d7baa1d792f434767bad0726a44843fb4f396efcf889968fb18cc5578f03809 This adds a new required To fix this, we had to add Instead, the property should have been added as optional, then it would have been a truly non-breaking change - our code would have continued compiling and behaving as it was before without modifying our code at all. Adding this type X2jOptions = {
// ...
ignorePiTags: boolean;
transformTagName?: ((tagName: string) => string) | false;
}; -- This is a similar issue that happened with the addition of other features/options, such as Are the types updated by hand? I should be able to come up with a test that will just compile some TypeScript and error on breaking changes. I can come up with something and submit a PR. |
I got you and it is really helpful. Since most of the options are kind of optional so we can update typings. Yes, types are updated manually. |
@amitguptagwl I submitted a PR with tests to ensure the types are set as optional going forward. This should prevent these issues in the future. |
after upgrading we encounter the following error from TSC
in previous version,
parse()
returnsany
so we were able to index itThe text was updated successfully, but these errors were encountered: