Migration 2.0.3 - pb toolTip

Hello,

I migrated go / js from version 1.8.34 to 2.0.3.

Now, I have a following error in the tooltip in the code below.

TS2345: Argument of type ‘{ toolTip: GraphObject; }’ is not assignable to parameter of type ‘string | EnumValue | GraphObject | Binding | PanelLayout | RowColumnDefinition | (Partial &…’. Type ‘{ toolTip: GraphObject; }’ is not assignable to type ‘(string | EnumValue | GraphObject | Binding | PanelLayout | RowColumnDefinition | (Partial …’. Property ‘includes’ is missing in type ‘{ toolTip: GraphObject; }’.

	let $ = go.GraphObject.make;
	
	// @ts-ignore
	this.palette.nodeTemplate = $(go.Node, go.Panel.Spot,
		// Left area of the node (only the background)
		$("Shape", GO_RECTANGLE,
			{
				strokeWidth: 0,
				desiredSize: new go.Size(50, 70)
			},
			new go.Binding("fill", "_transientProperties", (t) => {
				return t.color;
			})
		),
		// Icon of the node (above the full background)
		$("Shape",
			{
				fill: "#fff",
				strokeWidth: 0,
				margin: 8,
				alignment: go.Spot.Center
			},
			new go.Binding("geometry", "_transientProperties", (t) => {
				return go.Geometry.parse(t.icon, true);
			})
		),
		{
			toolTip:
				$("ToolTip",
					$("TextBlock", { margin: 6 },
						new go.Binding("text", "name"))
				)
		}
	);

do you have an idea?

As described in the Change Log: GoJS Change Log :

We have improved the declarations for GraphObject.make. You may find that you will need to cast the result of calling this function or pass a result type when the first argument is a string. For example: $(go.Node, . . ., { contextMenu: $<go.Adornment>(“ContextMenu”, . . .) }, . . …

In v2.0.4 we will improve the declaration for GraphObject.make even more to cover some of these cases, at the expense of making the type declaration even more incomprehensible.

1 Like