Skip to content

qjebbs/sketch.d.ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

Install and save to devDependencies:

npm install --save-dev git+https://github.com/qjebbs/sketch.d.ts.git

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

  • "Sketch runs JavaScript code in JavaScriptCore, with full ES6 support"(Here).
  • Otherwise, TypeScript will introduce libs like DOM, which leads to duplicated definition to Document etc., and other unexpected behaviours.
{
    "compilerOptions": {
        "lib": [
            "es6"
        ]
    }
}

Summary

This package contains type definitions for Sketch JavaScript API.

Examples

// Require all
var sketch: Sketch = require('sketch');

// Or, require without UI, Settings, DataSupplier, Async,
var sketchDom: SketchDom = require('sketch/dom');
// and require others according to your needs
var async: Async = require('sketch/async');
var DataSupplier: DataSupplier = require('sketch/data-supplier');
var UI: UI = require('sketch/ui');
var Settings: Settings = require('sketch/settings');

var document: Document = sketch.getSelectedDocument();
var page: Page = document.selectedPage;

About

TypeScript definitions for Sketch JavaScript API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published