Skip to content

v2 custom tags: outdated doc and/or broken types #429

Closed
@3bl3gamer

Description

@3bl3gamer

Describe the bug
In the Writing Custom Tags there is an example:

  stringify(item, ctx, onComment, onChompKeep) {
    ...
    return stringifyString({ value: key }, ctx, onComment, onChompKeep)
  }

It worked in v1.10 but in v2.1 it returns type error:

Argument of type '{ value: string; }' is not assignable to parameter of type 'Scalar<unknown>'.
  Type '{ value: string; }' is missing the following properties from type 'Scalar<unknown>': toJSON, clone, [NODE_TYPE]

To Reproduce

Create custom tag with

  stringify(item, ctx, onComment, onChompKeep) {
    return stringifyString({ value: 'test' }, ctx, onComment, onChompKeep)
  }

Expected behaviour

No error.

Versions:

  • Environment: Node: 19.1.0
  • yaml: yaml: 2.1.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions