Skip to content

ILST: ScriptUIGraphics.newBrush() and newPen() use an incorrect parameter type #163

Description

@YukiWorks432

Thank you for maintaining Types-for-Adobe.

The type parameter of ScriptUIGraphics.newBrush() appears to be declared as typeof ScriptUIGraphics.BrushType. As a result, passing an enum value produces a TypeScript error:

const brush = graphics.newBrush(
  ScriptUIGraphics.BrushType.SOLID_COLOR,
  [1, 1, 1, 1],
);
Argument of type '_BrushOrPenType' is not assignable to parameter of type 'typeof _BrushOrPenType'.

It seems that the parameter should accept _BrushOrPenType rather than typeof _BrushOrPenType.

The same issue may also apply to ScriptUIGraphics.newPen() and other related declarations.

Would changing the parameter type as follows be appropriate?

newBrush(
  type: _BrushOrPenType,
  color: number[],
  name?: string,
): ScriptUIBrush;

Thank you for taking a look.

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