Giter Site home page Giter Site logo

Comments (3)

pklaschka avatar pklaschka commented on June 15, 2024

@mattThousand

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.

pklaschka avatar pklaschka commented on June 15, 2024

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.

mattThousand avatar mattThousand commented on June 15, 2024

@pklaschka that's perfect - thank you!

from typings.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.