镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Incorrect return type for tagValueProcessor and attributeValueProcessor in XmlBuilderOptions #581

Closed

Description

@monholm
  • 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

Activity

  1. github-actions commented on May 31, 2023

    @github-actions

    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.

  2. added a commit that references this issue on May 31, 2023
    af7dd92
  3. added a commit that references this issue on May 12, 2024
    2ae1f62
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions