Comments (3)
First, I have fixed a few bugs regarding the typings. Could you please try it with npm i https://github.com/AdobeXD/typings/tarball/pklaschka-patch-typescript-errors
?
Secondly, you need to import directly from scenegraph
(not from ../node_modules/@adobexd/typings/types/scenegraph
). Then, you can specify how that gets resolved in your tsconfig.json
. For example, you could use something like this:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"baseUrl": ".",
"paths": {
"scenegraph": ["./node_modules/@adobexd/typings/types/scenegraph"],
"application": ["./node_modules/@adobexd/typings/types/application"],
"commands": ["./node_modules/@adobexd/typings/types/commands"],
"uxp": ["./node_modules/@adobexd/typings/types/uxp"],
"os": ["./node_modules/@adobexd/typings/types/os"]
},
"typeRoots": ["@types","./node_modules/@adobexd/"]
}
}
from typings.
Your package.json should then look something like this:
{
"name": "xd-typescript-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc -p ."
},
"devDependencies": {
"@adobexd/typings": "https://github.com/AdobeXD/typings/tarball/pklaschka-patch-typescript-errors"
}
}
Your .ts
file something like this:
import {Rectangle, SceneNode} from "scenegraph";
import application = require("application");
import uxp = require('uxp');
function test() {
// do stuff
}
module.exports.commands = {test: test};
from typings.
@pklaschka that's perfect - thank you!
from typings.
Related Issues (20)
- Reimagine structure with samles etc. HOT 4
- JSDoc / TSDoc / Comment Spec HOT 4
- LinearGradient and RadialGradient do not exist in scenegraph HOT 1
- Missed properties for RadialGradientFill HOT 1
- RenditionSettings make format specific properties optional
- make RenditionSettings.type strongly types HOT 2
- RenditionSettings.outputFile
- tsconfig.json incorrectly relies upon browser DOM types HOT 2
- Is `Line.setSTartEnd` typo? HOT 1
- 'SceneNode' refers to a value, but is being used as a type here ts(2749) HOT 13
- SceneNode doesn't contain addChild, but all derived classes/types do, shouldn't it be on SceneNode itself? HOT 2
- XD 25: application.activeDocument
- Suggestion: Call out custom type name overrides in ReadMe HOT 1
- Why add both tsconfig.json and jsconfig.json? HOT 15
- "Typings" is an Archaic Term [and Field Name] (package.json)
- using with`@types/node` inflicts compiler error about duplicate definition HOT 3
- Update typings to XD 29
- A couple type problems HOT 2
- Is this project still active? HOT 3
- Typings for Photoshop? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typings.