You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
createTextPath only accepts VectorNode, so its own documented example does not compile #388
figma.createTextPath is typed as taking a VectorNode, but the JSDoc for the same method says the node "can be VectorNodes, shape nodes (Rectangle, Ellipse, Polygon, Star), or Line nodes", and the example in that JSDoc passes an ellipse.
What happens: the documented example fails to type check.
error TS2345: Argument of type 'EllipseNode' is not assignable to parameter of type 'VectorNode'.
The same error appears for RectangleNode, PolygonNode, StarNode and LineNode. Plugin authors have to cast or flatten the shape first, even though the API accepts these nodes directly.
What should happen: every node type listed in the @param node description is accepted, so the example compiles without a cast.
Root cause: the declaration in plugin-api.d.ts and plugin-api-standalone.d.ts is createTextPath(node: VectorNode, startSegment: number, startPosition: number): TextPathNode. The parameter type was never widened to match the documented set of vector like nodes.
Activity