Skip to content

TS regression: Narrowing of MathNodes by type #2810

@ChristopherChudzicki

Description

@ChristopherChudzicki

Describe the bug
Prior to v11.3 (not sure how far back, but certainly at least 10), MathNode would be narrowed based on its type property:

const doStuffWithMathNode(node: MathNode) => {
  if (node.type === 'FunctionAssignmentNode) {
    // now TS knows that node is a FunctionAssignmentNode and lets you access associated props
    // like node.params
  }
  // back to being a wider MathNode
}

To Reproduce

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions