3.0.0-alpha.0 • Published 3 years ago

@chpio/sketch v3.0.0-alpha.0

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

TypeScript definitions for Sketch JavaScript API

Installation

Install and save to devDependencies:

npm install --save-dev @types/sketch@npm:@chpio/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;