Typings for Adobe XD and (UXP)[https://www.adobe.io/xd/uxp/uxp/] Plugin Development
These Type Declaration files provide your IDE (e.g. Visual Studio Code or WebStorm) with information about the XD API surface, enabling type checking, autocomplete suggestions, and more.
To get started
- install the package via npm:
npm i adobexd-types`
- add the typings file to
"typeRoots"
yourjsconfig.json
ortsconfig.json
:{ "compilerOptions": { "typeRoots": ["node_modules/adobexd-types"] }, }
- (optional) add the UXP WebComponents to the
JSX.IntrinsicElements
namespace by adding a reference to atypes.d.ts
file/// <reference path="./node_modules/adobexd-types/uxp/jsxWebComponents.d.ts" />
These type declarations track the contents of the official documentation. If an issue with the type declarations stems from an issue with the official documentation, then the type declaration files will be fixed once the issue is addressed in the documentation. This is intentional so as to keep the type declarations both maintainable and in sync with the documentation.
A few notable exceptions include:
- The
application.import()
function cannot be declared becauseimport
is a reserved TypeScript keyword (not sure if this can be fixed). It is declared asapplication.importFiles()
instead. - To avoid ambiguity with the DOM
Selection
type, the interfaceSelection
is also provided as an aliasXDSelection
and exported from the'scenegraph'
module