These are chat archives for TypeStrong/atom-typescript

6th
Apr 2015
Basarat Ali Syed
@basarat
Apr 06 2015 02:36
blob
@cmichaelgraham aurelia ts has a circular dependency :rose:
Basarat Ali Syed
@basarat
Apr 06 2015 03:09
Basarat Ali Syed
@basarat
Apr 06 2015 04:18
blob
all the cycles in aurelia ts
Bruce Mitchener
@waywardmonkeys
Apr 06 2015 04:27
Looks nice.
@basarat Hmm, my cfg.test.ts uses chai, but that doesn't show up in the dependency view.
Basarat Ali Syed
@basarat
Apr 06 2015 04:32
@waywardmonkeys yes. Only .ts dependencies shown for now
Bruce Mitchener
@waywardmonkeys
Apr 06 2015 04:38
but I have a references path for a .d.ts that pulls in .d.ts for chai & mocha.
Basarat Ali Syed
@basarat
Apr 06 2015 04:39
Correction : It only works for external modules with relative paths :)
so no .d.ts no require("chai")
Bruce Mitchener
@waywardmonkeys
Apr 06 2015 04:45
everything is terrible.
Basarat Ali Syed
@basarat
Apr 06 2015 04:45
@waywardmonkeys huh?
Bruce Mitchener
@waywardmonkeys
Apr 06 2015 04:45
Just found that if I use ES6 syntax for some module stuff, I break tslint.
Basarat Ali Syed
@basarat
Apr 06 2015 04:45
haha :)
yeah. TS1.5 is new ground :)
Bruce Mitchener
@waywardmonkeys
Apr 06 2015 04:47
at least they're working on it.
Michael
@michaelsg
Apr 06 2015 04:48
@basarat Could we do something so that a local version of typescript (like a local npm dep) could be used by the editor for all TS tasks - intellisense, generate on save, batch build (which could just be your local gulp/grunt).
Bruce Mitchener
@waywardmonkeys
Apr 06 2015 04:48
@basarat I told you last week that it feels like I'm trying this out 2 months early. :)
Basarat Ali Syed
@basarat
Apr 06 2015 05:31

Could we do something so that a local version of typescript (like a local npm dep) could be used by the editor for all TS tasks

You can clone the repo and point typescript to whatever you want in package.json.

Its been on the plan TypeStrong/atom-typescript#57 for quite a while to support custom typescript versions
@michaelsg would you like this driven by tsconfig?
Michael
@michaelsg
Apr 06 2015 05:35
I'm not sure. Wht makes most sense? Just because you have a dep on ms/ts doesn't mean you are using it to build your files... Does the version in the tsconfig do anything? Does tsc require it to match? Does a/ts use it?
Basarat Ali Syed
@basarat
Apr 06 2015 05:37

Does the version in the tsconfig do anything? Does tsc require it to match? Does a/ts use it?

no to all. Its just for convenience so that its there in the tsconfig for future devs to make sense of the code and why its was written in a particular way

tconfig: {
    typescript: './custom'
}
And then require(typescript) should resolve to this custom path.
It gets hairy though, can't really support multiple versions (different tsconfig files) in same atom instance without significant rewrite
Michael
@michaelsg
Apr 06 2015 05:40
I was wondering.... tricky.
Basarat Ali Syed
@basarat
Apr 06 2015 05:40
I want projects to be portable :(
Michael
@michaelsg
Apr 06 2015 05:49
can it already be changed globally?
Basarat Ali Syed
@basarat
Apr 06 2015 05:52
Not yet. But you can point https://github.com/TypeStrong/atom-typescript/blob/master/package.json#L34 to whereever and run npm install e.g I've had : https://github.com/TypeStrong/atom-typescript/blob/0dd7f0cde18a101a7c578cc6b2816efcb84a9106/package.json#L34 in the past https://github.com/Arnavion/typescript-github/tarball/2015-03-21-0d2a5bbf7c7409671e29387b17fcd20e3f9776bc
Ps: created a clearer issue : TypeStrong/atom-typescript#236
Basarat Ali Syed
@basarat
Apr 06 2015 05:58
alright I am off for now :rose:
Michael
@michaelsg
Apr 06 2015 06:32
I will try that out. Thank you.
Mike Graham
@cmichaelgraham
Apr 06 2015 11:09

wow - parameter decorators rule !!!!!!!!!!!!!!! see this repo

here's the output from running the tests:

LOG: 'injectMe:'
LOG: '  type: class A'
LOG: '  type: class B'
LOG: '  some key'

and the code:

module ParameterDecorators {
  class A {
    static typeName:string = "type: class A";
    public instanceTypeName = "instance: class A";
  }

  class B {
    static typeName:string = "type: class B";
    public instanceTypeName = "instance: class B";
  }

  @injectTest(A, B, "some key")
  class C {
    static injectMe: Array<any> = [];
    constructor(a: A, b: B) {
    }
  }

  function injectTest(...rest) {
    return function(target): void {
      target["injectMe"] = rest;
    }
  }

  describe("decorators", function() {
    it("should inject dependency-injection keys", function() {
      var c = new C(new A(), new B());
      console.log("injectMe:");
      for (let parm of C.injectMe) {
        if (typeof(parm) === "function") {
          console.log("\t" + parm["typeName"]);
        } else {
          console.log("\t" + parm)
        }
      }
    });
  });
}
Mike Graham
@cmichaelgraham
Apr 06 2015 20:46

i've been asked to accomplish this:

@inject(A, B, "some key")
  class C {
    static injectMe: Array<any> = [];
    constructor(a: A, b: B) {
    }
  }

  function inject(...rest) {
    return function(target): void {
      target["inject"] = rest;
    }
  }

but without specifying the keys in the inject decorator, but instead having the decorators pick up the constructor's class functions automatically with something along these lines:

inject(@parameterTypes types:Function[]){ ... }
Mike Graham
@cmichaelgraham
Apr 06 2015 21:19
i'm looking for how to do what @jonathandturner describes here