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

Incorrect return type for tagValueProcessor and attributeValueProcessor in XmlBuilderOptions #581

Closed
4 of 5 tasks
monholm opened this issue May 31, 2023 · 1 comment · Fixed by #582
Closed
4 of 5 tasks

Comments

@monholm
Copy link
Contributor

monholm commented May 31, 2023

  • Are you running the latest version?
  • Have you included sample input, output, error, and expected output?
  • Have you checked if you are using correct configuration?

Description

Both tagValueProcessor and attributeValueProcessor are declared as returning a string, but the function should allow returning the value as is (which is also the default).

Code

const xmlBuilder = new XMLBuilder({tagValueProcessor: (name, value) => value});

Output

Type '(name: string, value: unknown) => unknown' is not assignable to type '(name: string, value: unknown) => string'.
  Type 'unknown' is not assignable to type 'string'.ts(2322)
fxp.d.ts(65, 3): The expected type comes from property 'tagValueProcessor' which is declared here on type 'Partial<XmlBuilderOptions>'

expected data

No typescript error.

Would you like to work on this issue?

  • Yes
  • No
@github-actions
Copy link

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.

monholm added a commit to monholm/fast-xml-parser that referenced this issue May 31, 2023
amitguptagwl pushed a commit that referenced this issue May 12, 2024
…582)

Resolves #581

Co-authored-by: Simon-TechForm <73996878+Simon-TechForm@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant