These are chat archives for TypeStrong/atom-typescript

5th
Apr 2015
Basarat Ali Syed
@basarat
Apr 05 2015 00:12
@cmichaelgraham not a good story at the moment. One would need to write something like : https://github.com/karma-runner/karma-coffee-preprocessor using https://github.com/teppeis/typescript-simple#source-map but TSS needs to be upgraded to use the atom-typescript version of TS
Matt Traynham
@mtraynham
Apr 05 2015 01:59
@basarat Looking for someone fluent in TypeScript. Is export import still allowed when using ES6 import syntax?
export import Foo from './Foo';
class Foo {
 ....
}
export default Foo;
Basarat Ali Syed
@basarat
Apr 05 2015 02:24
blob
@mtraynham guess not
Basarat Ali Syed
@basarat
Apr 05 2015 02:38
blob
but you don't need to come up with new names like we needed before ^
There might be a simpler syntax out there that still makes ts happy :smiley:
Michael
@michaelsg
Apr 05 2015 02:40
export Foo from './Foo'
Basarat Ali Syed
@basarat
Apr 05 2015 02:41
blob
@michaelsg TS is a bit fidgetty with it at the moment
Michael
@michaelsg
Apr 05 2015 02:41
yeah, I know.
Bruce Mitchener
@waywardmonkeys
Apr 05 2015 02:43
I think I'm using export import ... in a project using 1.5.0-alpha
I forgot to sleep last night though, so I'll double check.

index.js:

export import CFG = require('./cfg');
export import HavlakLoopFinder = require('./havlak');

elsewhere:

import {CFG} from './node_modules/code-analysis/lib/index';

var bb = new CFG.BasicBlock(1);
I'm inordinately proud of having gotten that working. :worried:
Basarat Ali Syed
@basarat
Apr 05 2015 02:47
@waywardmonkeys cool first one is commonjs module syntax @mtraynham wants an export import for ES6 import / from syntax
Matt Traynham
@mtraynham
Apr 05 2015 02:47
right, I have the commonjs syntax working
Bruce Mitchener
@waywardmonkeys
Apr 05 2015 02:48
ohhhh.
Matt Traynham
@mtraynham
Apr 05 2015 02:48
I imagine the need to support bundled modules is becoming less & less with ES6
so I don't know if anyone has needed this case yet...
Bruce Mitchener
@waywardmonkeys
Apr 05 2015 02:49
what are bundled modules ? When you use dts-bundler or dts-generator?
Matt Traynham
@mtraynham
Apr 05 2015 02:49
bundled as in Webpack or Browserify
Bruce Mitchener
@waywardmonkeys
Apr 05 2015 02:49
oh, I don't do that sort of thing.
Matt Traynham
@mtraynham
Apr 05 2015 02:50
yeah, you can have multiple module entry points with Webpack (not sure about browserify)
but if you're not using jspm or an ES6 System loader, I was typically using a single module entry point that exported all my other modules
modules in that context, being other classes/enums...
Bruce Mitchener
@waywardmonkeys
Apr 05 2015 02:51
I'm currently just using TypeScript to write stuff that will all run in an Atom Shell app ... but this is like week 2 for me in TypeScript. (And I don't typically use Node or anything else in this ecosystem.)
Matt Traynham
@mtraynham
Apr 05 2015 02:52
gotcha :)

@basarat I wonder if just the two liner works?

import Foo from './Foo';
export Foo;

by the way, how did you get ES6 syntax to work with atom-typescript?

Michael
@michaelsg
Apr 05 2015 02:54
@basarat Shortest I can manage with 1.5 Alpha is import Foo from './foo' export {Foo}
Basarat Ali Syed
@basarat
Apr 05 2015 02:55
@michaelsg nice!
Matt Traynham
@mtraynham
Apr 05 2015 02:55
@michaelsg Ahh that's not too bad.
Michael
@michaelsg
Apr 05 2015 02:55
I think the Es6 I see working with the transcompilers is export Blah from '...'
Matt Traynham
@mtraynham
Apr 05 2015 03:04
@basarat maybe I have an outdated version, doesn't seem to recognize the from keyword
Basarat Ali Syed
@basarat
Apr 05 2015 03:04
@mtraynham can you open that file in atom? Or is it some other file?
Matt Traynham
@mtraynham
Apr 05 2015 03:05
I'll copy paste the contents, see what happens
nvm cloning is probably more approrpiate
nope giving me warnins
warnings*
Basarat Ali Syed
@basarat
Apr 05 2015 03:07
Which version of atom-typescript?
Matt Traynham
@mtraynham
Apr 05 2015 03:07
TypeScript: Declaration or statement expected
0.86.0
Basarat Ali Syed
@basarat
Apr 05 2015 03:07
WOW. reallly old
Matt Traynham
@mtraynham
Apr 05 2015 03:08
holy, just saw the update
hah
nvm. 2.9.0
Basarat Ali Syed
@basarat
Apr 05 2015 03:08
close atom and run:
apm uninstall atom-typescript
apm install atom-typescript
Matt Traynham
@mtraynham
Apr 05 2015 03:08
kind of strange, I've only had atom for a ~month
Basarat Ali Syed
@basarat
Apr 05 2015 03:08
@mtraynham I've been working on it quite a lot :)
Bruce Mitchener
@waywardmonkeys
Apr 05 2015 03:08
@mtraynham: @basarat is trying to see if version numbers run out by going through them quickly. :)
and you publish once per commit almost!
Basarat Ali Syed
@basarat
Apr 05 2015 03:09
@waywardmonkeys yes. I want people to get the good stuff as it happens :)
Matt Traynham
@mtraynham
Apr 05 2015 03:09
:) if it ain't broke, publish it.
Basarat Ali Syed
@basarat
Apr 05 2015 03:10
@waywardmonkeys and I don't know if I'll be working on it the next hour or not.
@mtraynham you might also want to look at : https://github.com/TypeStrong/atom-typescript/blob/master/docs/CHANGELOG.md to see whats different
only breaking changes ;)
Matt Traynham
@mtraynham
Apr 05 2015 03:12
@basarat heh good ol' F keys :)
thanks tho
Basarat Ali Syed
@basarat
Apr 05 2015 03:14
:)
It was beginning to be "this key is from intellij" , "this is from eclipse" , "this is from visual studio" ..... basically what I got stuck with over time. Decided I'll just go with VS default from now on :)
also find references: resharper : ctrl+k+r (what I used) , VS : shift f12 , webstorm : alt+f7 ... That was the kicker. I'm not going to put brains into this anymore :)
nobody in office used what I was using
Basarat Ali Syed
@basarat
Apr 05 2015 03:24
blob
needeless to say. It needs a bit of polish
Michael
@michaelsg
Apr 05 2015 03:38
It's pretty.
Matt Traynham
@mtraynham
Apr 05 2015 03:47
@basarat it's the thought that counts :)
Bruce Mitchener
@waywardmonkeys
Apr 05 2015 03:53
@basarat Have you ever seen http://opendylan.org/history/apple-dylan/screenshots/browsers.html ? (from the 1990s)
Michael
@michaelsg
Apr 05 2015 03:54
I have a book on Dylan :-)
Bruce Mitchener
@waywardmonkeys
Apr 05 2015 03:56
@michaelsg: Nice! which one?
(if you tell me the color, I'll know)
white, gray or a horrible purple / celeste / etc mix.
Michael
@michaelsg
Apr 05 2015 03:57
purple
eggplant
Bruce Mitchener
@waywardmonkeys
Apr 05 2015 03:57
so, the Dylan Programming Guide by 4 authors.
@michaelsg: I'm one of the maintainers / developers of Dylan now.
Michael
@michaelsg
Apr 05 2015 03:58
Oh, neat!
I know it's time has passed but for the tiny Newton platform, I loved NewtonScript.
Bruce Mitchener
@waywardmonkeys
Apr 05 2015 03:59
NewtonScript was nice. Totally different from Dylan though. The Dylan-based Newton never shipped. Sad times.
Michael
@michaelsg
Apr 05 2015 04:00
I know. I had years of notes on my newton. it was very advanced for its time. The handwriting recognition still has never been beat (for me).
Bruce Mitchener
@waywardmonkeys
Apr 05 2015 04:01
@michaelsg And to add insult to injury, the odds are that that technology is completely lost at Apple. They may not even know where the code is. :)
Basarat Ali Syed
@basarat
Apr 05 2015 04:01
haven't seen or heard of it
Bruce Mitchener
@waywardmonkeys
Apr 05 2015 04:01
@basarat I was just pointing out that the browsers for some stuff look nice in that environment.
Michael
@michaelsg
Apr 05 2015 04:01
anyone done any work on the aurelia source? for pr or just to play? With all these explicit dependencies and jspm it's been impossible (for 4 hours now?) to convince jspm to source one of the aurelia packages from my local filesystem instead of from github.
Bruce Mitchener
@waywardmonkeys
Apr 05 2015 04:02
Apparently @michaelsg and I are the old people here.
Basarat Ali Syed
@basarat
Apr 05 2015 04:02
@michaelsg meet : @cmichaelgraham the aurelia TS expert :heart:
Michael
@michaelsg
Apr 05 2015 04:03
I found a discussion of this very topic - authoring jspm packages/testing them locally and combined app/package dev with local packages. jspm link is the prefered solution, but it doesn't work on Windows. :-( I'll have to see if my Pi is up to compiling aurelia.
Bruce Mitchener
@waywardmonkeys
Apr 05 2015 04:04
@michaelsg When I'm on Windows (rare these days), I just keep a Linux VM in VirtualBox around for stuff like that. :/
Michael
@michaelsg
Apr 05 2015 04:04
yeah, I have a few running...
somewhere... on my big Vm server MONSTER
Matt Traynham
@mtraynham
Apr 05 2015 04:06
@waywardmonkeys so glad I havn't touched a Windows machine in >7 years...
hah :P
Michael
@michaelsg
Apr 05 2015 04:06
ok, don't start that.
Matt Traynham
@mtraynham
Apr 05 2015 04:09
I won't, just have this long running vendetta with that OS...
is jspm worth it? I've been meaning to try it out.
Michael
@michaelsg
Apr 05 2015 04:11
if you wanna get and mess with the Aurelia stuff it's almost a requirement. Yes, works with other stuff, but only the jspm/gulp stuff is really alwasys up-to-date.
I don't like it. So far. Does too much and not as well as i can manually.
Matt Traynham
@mtraynham
Apr 05 2015 04:12
I assume you're talking client side (i.e. Aurelia)
Michael
@michaelsg
Apr 05 2015 04:12
Sorry. jspm and I had a falling out earlier this evening. We're going to make up over some ice cream on this Saturday evening :-)
Matt Traynham
@mtraynham
Apr 05 2015 04:13
:)
Michael
@michaelsg
Apr 05 2015 04:13
yes. It's way young like 0.15 so who know how good it might become.
Matt Traynham
@mtraynham
Apr 05 2015 04:13
replaced by the builtin System loader maybe?
that's what they were going for right?
Michael
@michaelsg
Apr 05 2015 04:14
shrug
Matt Traynham
@mtraynham
Apr 05 2015 04:15
heh
well good luck, seems Angular is on that bandwagon as well, so maybe you can get some hints from the 2.0 source code
Basarat Ali Syed
@basarat
Apr 05 2015 07:24
Not enjoying d3
        // Poor mans loop of node (`this`) as well as the associated data element `o`
        nodes.style("stroke-opacity", function(o: D3LinkNode) {
            if (isConnected(d, o)) {
                var thisOpacity = 1;
            } else {
                thisOpacity = opacity;
            }
            this.setAttribute('fill-opacity', thisOpacity);
            this.setAttribute('stroke-opacity', thisOpacity);
            if (thisOpacity == 1) {
                this.classList.remove('dimmed');
            } else {
                this.classList.add('dimmed');
            }
            return thisOpacity;
        });
Matt Traynham
@mtraynham
Apr 05 2015 09:30
@basarat It's based on fluent interfaces, so all that stuff is chainable
Matt Traynham
@mtraynham
Apr 05 2015 09:36
Avoid the use of style and use attr.
// memoize the results if needed
function isConnected(d) { // d is datum. 
...
}
nodes
    .attr('fill-opacity', isConnected)
    .attr('stroke-opacity', isConnected)
    .classed(function (d) { isConnected(d) ? 'dimmed' : '' });
Basarat Ali Syed
@basarat
Apr 05 2015 09:38
@mtraynham I have arrived at the opinion that the quality of code I was working with was a poor representation of d3. But then again. Its not the first time :)
Matt Traynham
@mtraynham
Apr 05 2015 09:39
:)
d3 is a monster, that a lot of people get wrong the first few times.
Mike Graham
@cmichaelgraham
Apr 05 2015 09:42
Matt Traynham
@mtraynham
Apr 05 2015 09:43
@basarat there's a huge update coming for that type definition though, make's the whole thing a lot more generic and easier to understand in TypeScript
@cmichaelgraham That question is a bit flawed, you are modifying a static variable with an instance constructor
Mike Graham
@cmichaelgraham
Apr 05 2015 09:45
can you explain. i'm such a noob with decorators
do you see what i'm trying to accomplish?
Matt Traynham
@mtraynham
Apr 05 2015 09:46
kind of, it looks like when you invoke new D(new A(), new B()) you expect the metadata array to be updated
Mike Graham
@cmichaelgraham
Apr 05 2015 09:48
well, not really. in aurelia's dependency-injection repo, you define a static array in your class, and the di container will use that array as keys into the container to provide your constructor with the right constructor parameters
i want to allow class authors to use a decorator to pick up the declared types to automatically generate the static array
Matt Traynham
@mtraynham
Apr 05 2015 09:49
but say you call that twice:
new D(new A(), new B());
new D(new A(), new B());
D.metadata.length // 4?
is that expected?
Mike Graham
@cmichaelgraham
Apr 05 2015 09:49
ah - i see what you are saying
can you look at this? i think that is a similar question to mine
here is an example of what i'm trying to make nicer with decorators
Matt Traynham
@mtraynham
Apr 05 2015 09:53
I see, just like the Angular1.X injection
Mike Graham
@cmichaelgraham
Apr 05 2015 09:53
haha yeah - there are some roots in that project ;)
Matt Traynham
@mtraynham
Apr 05 2015 09:54
it's an interesting question, my guess is you are trying to avoid the double declaration of dependencies (i.e. once in the static array, once in the constructor)
Mike Graham
@cmichaelgraham
Apr 05 2015 09:55
exactly. and pick up the goodness of typescript types also
Matt Traynham
@mtraynham
Apr 05 2015 09:56
hmm...
Mike Graham
@cmichaelgraham
Apr 05 2015 09:56
i'm worried that what i want is actually a typescript non-goal
type info disappears at runtime
and decorators happen at runtime, right?
Matt Traynham
@mtraynham
Apr 05 2015 09:56
right
you'd need the code to generate that static list at compile time
Mike Graham
@cmichaelgraham
Apr 05 2015 09:57
i'm an old C# dog, i love reflection. can't seem to break old habits
Matt Traynham
@mtraynham
Apr 05 2015 09:57
:)
so ng-annotate does something like you're requesting
as an example:
Mike Graham
@cmichaelgraham
Apr 05 2015 09:58
yeah and ng2 was headed down that path for awhile with atscript and rttl
but it looks like they punted that
Matt Traynham
@mtraynham
Apr 05 2015 09:59
class Foo {
    /*@ngInject*/
    constructor($http: ng.IHTTPService) {
       ...
    }
}
Mike Graham
@cmichaelgraham
Apr 05 2015 10:00
right - but when they move to typescript they'll have the same issue i'm facing, right?
here's the repo, if you're interested: https://github.com/cmichaelgraham/spike-typescript-decorators
the thing processing @ngInject was at script, i think
Matt Traynham
@mtraynham
Apr 05 2015 10:04
yeah, @ngInject is a compile time script
I can't remember how ng2 di works
Mike Graham
@cmichaelgraham
Apr 05 2015 10:04
probably the static array
but i bet it isn't auto-magic
i bet you declare the array explicitly
not using decorators and typescript types
Matt Traynham
@mtraynham
Apr 05 2015 10:05
Well they have a whole DI service that does binding behind the scenes
so you can have constructor Foo(a: A) {}
err constructor(a: A) {}, but A could really be a B, if B extends A
which allows you to mock depenency injection
Mike Graham
@cmichaelgraham
Apr 05 2015 10:06
yep - makes sense
but the class with that constructor has to say what its constructor parameters are
Matt Traynham
@mtraynham
Apr 05 2015 10:07
that part I don't know
Mike Graham
@cmichaelgraham
Apr 05 2015 10:07
and since ng2 is moving to typescript, those won't be available at runtime untless the class author specifies them
Matt Traynham
@mtraynham
Apr 05 2015 10:07
if I remeber correctly, they actually have a function called bind
bind(Foo).with(a);
let me see if I can find that documentation
Mike Graham
@cmichaelgraham
Apr 05 2015 10:08
right that tells the container, when someone wants a key of Foo, give them the instance a
Matt Traynham
@mtraynham
Apr 05 2015 10:08
right
Mike Graham
@cmichaelgraham
Apr 05 2015 10:09
but the container has to know, when its constructing an object, the list of keys to pass to the constructor
that's the static array part
Matt Traynham
@mtraynham
Apr 05 2015 10:09
right, you'll need that static array defined ahead of time though if
Mike Graham
@cmichaelgraham
Apr 05 2015 10:10
agree
Matt Traynham
@mtraynham
Apr 05 2015 10:10
before the first call to the constructor
Mike Graham
@cmichaelgraham
Apr 05 2015 10:10
DI in C# can use reflection to get that array
but there is no equivalent in this strange new land ;)
Matt Traynham
@mtraynham
Apr 05 2015 10:10
:)
Mike Graham
@cmichaelgraham
Apr 05 2015 10:10
so you have to specify it
which is syntactically redundant with the type decls in the constructor
Matt Traynham
@mtraynham
Apr 05 2015 10:11
right
I was thinking you could use ng-annotate
Mike Graham
@cmichaelgraham
Apr 05 2015 10:11
but i am becomming more convinced that this is not possible with decorators since they are a runtime thing
Matt Traynham
@mtraynham
Apr 05 2015 10:11
since it does the same thing, to create $inject
yeah :(
AtScript was supposed to support run-time type annotations
Mike Graham
@cmichaelgraham
Apr 05 2015 10:12
i sure appreciate your guidance :) :)
i think it started to come apart and was too hard for the a2 team
Matt Traynham
@mtraynham
Apr 05 2015 10:12
np, I've only been on TS for ~4 months, so it's still new to me
Mike Graham
@cmichaelgraham
Apr 05 2015 10:12
so they decided to switch to typescript
Matt Traynham
@mtraynham
Apr 05 2015 10:13
yeah, I can imagine. it probably scared some people too...
like, "They wanted me to use Dart, but now they want me to use AtScript"
Mike Graham
@cmichaelgraham
Apr 05 2015 10:13
if you're interested, have a look at this aurelia typescript samples repo
my mission is to create typescript definitions for the public aurelia api
Matt Traynham
@mtraynham
Apr 05 2015 10:15
awesome. Auerlia does look promising, but I haven't had the chance to use it yet
still off in ng1 land...
Mike Graham
@cmichaelgraham
Apr 05 2015 10:15
i understand
ping me if you ever need any aurelia help :)
Matt Traynham
@mtraynham
Apr 05 2015 10:16
:) will do!
Mike Graham
@cmichaelgraham
Apr 05 2015 10:16
and thanks again
Basarat Ali Syed
@basarat
Apr 05 2015 10:16
blob
A dependency view seems a lot less useful than I anticipated
Mike Graham
@cmichaelgraham
Apr 05 2015 10:16
:)
@basarat i'm a bit obsessed with the idea of a d3js port to aurelia, once the svg templating & binding matures just a bit more
Basarat Ali Syed
@basarat
Apr 05 2015 10:17
blob
@cmichaelgraham cool :rose:
any idea how this can be useful in a sizable project?
Matt Traynham
@mtraynham
Apr 05 2015 10:18
@basarat pretty cool looking
Mike Graham
@cmichaelgraham
Apr 05 2015 10:19
i can tell you that understanding the dependency graph is very important to me
Basarat Ali Syed
@basarat
Apr 05 2015 10:19
@cmichaelgraham okay thanks. Now I don't feel like I wasted a day :)
Matt Traynham
@mtraynham
Apr 05 2015 10:19
is that just a tree of TypeScript class dependencies?
Basarat Ali Syed
@basarat
Apr 05 2015 10:19
@mtraynham yes
Matt Traynham
@mtraynham
Apr 05 2015 10:20
built from import statements? just curious
Mike Graham
@cmichaelgraham
Apr 05 2015 10:20
here's a spike with aurelia libs in typescript - uses atom & atom-typescript
Basarat Ali Syed
@basarat
Apr 05 2015 10:20
Yes. Sorry not class. But modules
Mike Graham
@cmichaelgraham
Apr 05 2015 10:20
it will give you a large view of dependencies
not all folders in there compile yet
these are building
• metadata
• path
• event-aggregator
• route-recognizer
• history-browser
• history
• logging
• logging-console
• dependency-injection
• http-client
• Router
• animator-css
• loader
• loader-default
• task-queue
maybe you could create some filtering controls that would help
just having module dependencies would be nice
Basarat Ali Syed
@basarat
Apr 05 2015 10:22
blob
Mike Graham
@cmichaelgraham
Apr 05 2015 10:23
or even folder dependencies
have to go offline for awhile. :)
Basarat Ali Syed
@basarat
Apr 05 2015 10:24
cool. Tracking : TypeStrong/atom-typescript#235
Matt Traynham
@mtraynham
Apr 05 2015 10:30
by the way, if you guys need some d3 help, I contribute to dc.js quite a bit and am pretty knowledgable on the library. There's also the d3 google group.