Skip to content

Inconsistent typescript definition for onNodePressed #113

@bermani

Description

@bermani

NestedListView declares the type of the onNodePressed prop as () => any

onNodePressed?: () => any

This prop gets passed directly to NodeView which has an inconsistent signature: (item: any) => any

onNodePressed?: (item: any) => any

Neither signature is accurate to the actual usage of the onNodePressed prop. The only time where the prop is actually used is this line:

if (this.props.onNodePressed) {
this.props.onNodePressed(this.state.node)
}

And the type of this.state.node is INode:

export interface IState {
node: INode

So the correct signature in all locations should be (node?: INode) => void

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions