Skip to content

Conversation

@fartinmartin
Copy link
Contributor

@fartinmartin fartinmartin commented May 17, 2025

The following lines work in ExtendScript, but will cause TypeScript to complain with (ts 2339):

ScriptUI.Alignment.LEFT // Property 'LEFT' does not exist on type '_Alignment'. 
ScriptUI.FontStyle.BOLD // Property 'BOLD' does not exist on type '_FontStyle'.
ScriptUIGraphics.PenType.SOLID_COLOR // Property 'SOLID_COLOR' does not exist on type '_BrushOrPenType'.

This is because in order to access the enum properties we need to reference their types via typeof. This PR adds this:

declare class ScriptUI {
  static readonly Alignment: typeof _Alignment
  static readonly FontStyle: typeof _FontStyle
}

declare class ScriptUIGraphics {
  static readonly BrushType: typeof _BrushOrPenType
  static readonly PenType: typeof _BrushOrPenType
}

@fartinmartin fartinmartin changed the title [ScriptUI] reference enums with typeof to properly access enum values [ScriptUI] reference enums with typeof to access enum properties May 17, 2025
@zlovatt zlovatt merged commit f86b5e7 into docsforadobe:master Jun 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants