3.0.0-alpha.2 • Published 2 years ago

@neonaut-pub/sketch v3.0.0-alpha.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

TypeScript definitions for Sketch JavaScript API

Installation

Install and save to devDependencies:

npm install --save-dev @types/sketch@npm:@neonaut-pub/sketch

It's necessary to config TypeScript (use tsconfig.json) to use es6 lib, since:

  • "Sketch runs JavaScript code in JavaScriptCore, with full ES6 support" (Here).
{
    "compilerOptions": {
        "lib": [
            "es6"
        ]
    }
}

Summary

This package contains type definitions for Sketch JavaScript API.

Examples

import sketch from "sketch";

// `document` has the type `undefined | Document`
const document = sketch.getSelectedDocument();

// `page` has the type `Page`
const page = document.selectedPage;