Skip to content

2D Plot Node Template: Unions are not allowed in return type #613

Open
@rowandempster

Description

@rowandempster

Copying directly from the given template:

import { Input, Messages } from "ros";
import { TwoDimensionalPlot, TwoDimensionalPlotLine } from "./types";

type GlobalVariables = { id: number };

export const inputs = ["/mpc_stats"];
export const output = "/webviz_node/";

// Populate 'Input' with a parameter to properly type your inputs, e.g. 'Input<"/your_input_topic">'
const publisher = (
  message: Input<"/mpc_stats">,
  globalVars: GlobalVariables
): TwoDimensionalPlot => {
  const lines: TwoDimensionalPlotLine[] = [];
  const points: TwoDimensionalPlotLine[] = [];
  const polygons: TwoDimensionalPlotLine[] = [];

  return {
    lines,
    points,
    polygons
  };
};

export default publisher;

Gives the TS compilation error Unions are not allowed in return type.DatatypeExtraction

TwoDimensionalPlot contains the union PointStyle, is this the issue?

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