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

refactor(xml-helpers): document & check function signature types #160

Merged
merged 3 commits into from
Oct 18, 2021

Conversation

raphinesse
Copy link
Contributor

@raphinesse raphinesse commented Mar 1, 2021

Motivation and Context

This PR adds type documentation to the util/xml-helpers module to more clearly document the interface of the module.

I already added this kind of type documentation before (to munge-util in #127). The types' correctness can be checked using TypeScript tooling.

Description

  • use ES6 method syntax (because VSCode generated a nicer starting point that way)
  • document & check function signature types
  • satisfy TS type checks: in a few cases our code was not 100% in line with the elementtree types. However both the old and new version should behave identically with regards to our use-cases

Testing

Checked type correctness of module using VSCode

@raphinesse raphinesse added this to the 4.0.3 milestone Mar 1, 2021
@raphinesse
Copy link
Contributor Author

Last call for reviews or objections.

Copy link
Contributor

@breautek breautek left a comment

Choose a reason for hiding this comment

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

lgtm

- `et.ElementText` is not always a string but always has `#toString`
- `et.ElementTag` is not always a string, but converting it to one
should be sufficient for our purposes
- `et.Element` is not a constructor, so it should be called w/out new
@raphinesse raphinesse merged commit 185b326 into apache:master Oct 18, 2021
@raphinesse raphinesse deleted the xml-helpers-types branch October 18, 2021 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants