Type-safe Photoshop scripting
npm install photoshop.d.ts
Add a reference to your target version, e.g.:
///<reference path="./node_modules/photoshop.d.ts/dist/cc/ps.d.ts"/>
The other references will automatically resolve.
///<reference path="./ps.d.ts"/>
var document = app.activeDocument; // Access global `app`
var layers = document.artLayers; // OK
var bogus = document.bogus; // Type Error
The typescript declarations are generated from the official javascript reference PDFs. The text is copied and pasted into local files. The parser will parse the raw text file and extract meaningful information from the respective chapters of the documentation. Once the parser has delivered a in-memory representation of the types and constants, the emitter will render types and constants as typescript files.
$ npm install && npm test
- Add typings for Adobe Photoshop CC
- Remove sample scripts from docs
- Sanitize docs
The project is up to a point where the parsers do a pretty good job,
although some manual fix ups need to be made to the raw text documents before
parsing (remove typos, inconsistent array notations etc) that would be awkward
and long-winded to write parsers for. The full list of these is currently to be
found in parsers/types.ts
. Since the source docs rarely change, they are
committed to this project and maintained here.