Skip to content

Function appendChild(node: Node) return wrong type #48

@bestwnh

Description

@bestwnh

The appendChild(node: Node) for Node return type should be same as the child, not the parent. Now if you use the div element to add a span, it would cause error. I'm currently using a method below instead.

func addNode<T: Node>(_ node: T) -> T {
    let result = self.jsValue.appendChild(node.jsValue)
    return T.init(from: result)!
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions