TS support for UXP and Photoshop

I found this directory in DfinitelyTyped: DefinitelyTyped/types/photoshop at master · DefinitelyTyped/DefinitelyTyped (github.com)

Is this the official one? But it looks like a very loose definition. e.g. batchPlay is defined as:

batchPlay(commands: any, options: any): Promise<import("./CoreModules").ActionDescriptor[]>;

It has commits from @Barkin – a dev on Ps, so I think you can consider it official. I’ll let him chime in to say for sure.

batchPlay is always going to be super loose here – it’s a wrapper around a lot of internals and enables you to do everything you can do w/ Actions in Ps. So I don’t think it wouldn’t make sense to provide full typings here – I can’t even imagine what the union of that would look like. Longer-term you should need to use to batchPlay less and less as the DOM API is improved :crossed_fingers:.

I understand. However I found it weird: for example, BatchPlayCommandOptions looks like:

export interface BatchPlayCommandOptions {
    propagateErrorToDefaultHandler?: boolean;
    historyStateInfo?: {
        name: string;
        target: object;
    };
    modalBehavior?: "wait" | "execute" | "fail";
}

…so where is synchronousExecution?

I saw the Photoshop UXP docs got a 2022 version and that Simon added a lot of types to his repository, so I updated the crawler at GitHub - hansottowirtz/adobe-uxp-types-crawler at update-2022. This time I also copied some new types from @types/photoshop. (Mostly the enums that were added in the 2022 docs)

Welcome to test and give feedback here or in the repo: npm i -D adobe-uxp-photoshop-types@0.0.7-beta.1 npm i -D @adobe-uxp-types/photoshop

1 Like

I like the “UXP” types. How serious are you about maintaining this (mainly action descriptors) in its best possible state? I could give you hundreds of suggestions on what to add/change. But not sure if you are in the mood for it :smiley:

Thank you! I’d like to maintain the crawler so when there is new documentation, the types get updated as well. (While waiting for the official @types/photoshop to catch up, because they’re too incomplete for us) However, for the action descriptors I’ve relied on the types of @simonhenke, and I haven’t used them myself that often, and due to time constraints I won’t be able to keep them completely accurate.

But I’d like to keep them accurate for the largest part, and make sure that the types are adjustable/override-able in a project if they’re not exactly correct.
I’d definitely be interested in hearing your most important suggestions though, and if something is just wrong I’ll also try to fix it asap. :slightly_smiling_face:

I registered the @adobe-uxp-types NPM organization, which is unofficial. If an Adobe employee has any remarks I will remove it and create another org.

This way, you can install the types like this: npm i -D @adobe-uxp-types/photoshop @adobe-uxp-types/uxp, and register them like this:

"typeRoots": ["node_modules/@types", "node_modules/@adobe-uxp-types"]