These are chat archives for TypeStrong/atom-typescript

6th
May 2015
Chris Mancini
@ChrisMancini
May 06 2015 02:14
I am certain I have something not configured properly.... I am trying to walkthrough the "Getting Started" for Aurelia, however I am using TypeScript. I am not getting very far...
import {autoinject} from 'aurelia-framework';
this line always says "Cannot find external module 'aurelia-framework'"
This is all very new to me, but I think it has to do with the config.js file (which does have an entry for 'aurelia-framework')
System.config({
  "map": {
    "aurelia-animator-css": "github:aurelia/animator-css@0.2.0",
    "aurelia-bootstrapper": "github:aurelia/bootstrapper@0.12.0",
    "aurelia-dependency-injection": "github:aurelia/dependency-injection@0.7.0",
    "aurelia-framework": "github:aurelia/framework@0.11.0",
...
and jspm reports it as installed
Basarat Ali Syed
@basarat
May 06 2015 02:22
@ChrisMancini You need to have this file : https://github.com/cmichaelgraham/aurelia-typescript-atom/blob/master/aurelia-dts/aurelia-framework.d.ts referenced from your tsconfig.json
Chris Mancini
@ChrisMancini
May 06 2015 02:36

Thank You so much! A couple things though. Walking through the example, I also had to import 'aurelia-http-client'. The import failed, because the .d.ts file looked like this:

...
declare module 'aurelia-http-client/index' {
    /**
     * An extensible HTTP client provided by Aurelia.
     *
     * @module HttpClient
     */
    export { HttpClient } from 'aurelia-http-client\http-client';
    export { HttpRequestMessage } from 'aurelia-http-client\http-request-message';
    export { HttpResponseMessage, mimeTypes } from 'aurelia-http-client\http-response-message';
    export { JSONPRequestMessage } from 'aurelia-http-client\jsonp-request-message';
    export { Headers } from 'aurelia-http-client\headers';
    export { RequestBuilder } from 'aurelia-http-client\request-builder';
}
...

If I switched the '\' for '/' it started working. I suspect I have something else configured incorrectly...

Basarat Ali Syed
@basarat
May 06 2015 02:38
@ChrisMancini you shouldn't be using \. The fact that it worked is coincidental perhaps because you are on windows. Please use /
Chris Mancini
@ChrisMancini
May 06 2015 02:39
I am using /. The package as retrieved from the link you provided is using \.
Chris Mancini
@ChrisMancini
May 06 2015 02:40
Yes, but in the aurelia-http-client/index module they all use \
Chris Mancini
@ChrisMancini
May 06 2015 02:44
Yes
Basarat Ali Syed
@basarat
May 06 2015 02:44
Identified as a bug in dts-generator
Chris Mancini
@ChrisMancini
May 06 2015 02:44
Excellent...Thanks!
Basarat Ali Syed
@basarat
May 06 2015 02:45
@ChrisMancini / @cmichaelgraham ref SitePen/dts-generator#20
@ChrisMancini you are on a mac aren't you?
Chris Mancini
@ChrisMancini
May 06 2015 02:49
No, this is on a Windows machine
I didn't generate the .d.ts files. I just pulled them off of github
Basarat Ali Syed
@basarat
May 06 2015 02:50

I didn't generate the .d.ts files. I just pulled them off of github

Of course. Will see how it goes. FWIW I'm not fixing it because I'd rather see Microsoft/TypeScript#2338 make it in

Micah Zoltu
@MicahZoltu
May 06 2015 03:56
Why does atom-typescript recommend " instead of '?
Basarat Ali Syed
@basarat
May 06 2015 04:25
@Zoltu doesn't recommend. You can change it in package settings :rose:
Just comes with a default :D
Micah Zoltu
@MicahZoltu
May 06 2015 04:27
Ah. Happen to have a link to details on what that setting looks like?
Basarat Ali Syed
@basarat
May 06 2015 04:28
blob
Micah Zoltu
@MicahZoltu
May 06 2015 04:29
Ah.
Thanks.
Micah Zoltu
@MicahZoltu
May 06 2015 06:17
I typed ' into that box but I am still prompted to change my 'single-quoted-strings' to "double-quoted-strings".
Micah Zoltu
@MicahZoltu
May 06 2015 06:23
Well, I get the lightbulb on the left, but quick-fix menu won't appear..
Changing quoting around word to "" yields same symptoms (still ' in the box you screenshotted above).
Jari Pennanen
@Ciantic
May 06 2015 06:50
I get lightbulbs with atom-typescript, but nothing appeared from them
Basarat Ali Syed
@basarat
May 06 2015 06:50
@Ciantic press alt+enter when you see them :rose:
kpgarrod
@kpgarrod
May 06 2015 08:51
I am trying to use webPack to bundle my app. I have added the necessary imports and exports to a section of the app and the code looks clean in atom. Now I'm facing some issues with the typescript compiler when webpack tries to assemble it, for instance, it seems that the compiler needs reference tags for tsds which I have removed since switching to atom. Any suggestions please?
Jari Pennanen
@Ciantic
May 06 2015 09:21
@kpgarrod which loader are you using? They all are broken at the moment: awesome-typescript-loade, ts-loader, typescript-loader under Windows
Jari Pennanen
@Ciantic
May 06 2015 09:43
your best bet is to try "ts-loader, "but it still has one file not found error lurking, not manifested in all setups
kpgarrod
@kpgarrod
May 06 2015 09:51
@Ciantic: I'm using awesome-typescript-loader
Jari Pennanen
@Ciantic
May 06 2015 09:52
it should work on *nix platforms
can't you add /// <reference /> tags?
kpgarrod
@kpgarrod
May 06 2015 09:52
I see ts-loader had an update 4 hours ago
Jari Pennanen
@Ciantic
May 06 2015 09:52
it should work if you put them there
kpgarrod
@kpgarrod
May 06 2015 09:53
I would hate to have to add reference tags to every file!
Jari Pennanen
@Ciantic
May 06 2015 09:53
yes, but ts-loader is not fully functional on Windows, neither is awesome-typescript-loader
kpgarrod
@kpgarrod
May 06 2015 09:53
is that what I would need to do?
Jari Pennanen
@Ciantic
May 06 2015 09:53
isn't it necessary to add it to main entry point?
kpgarrod
@kpgarrod
May 06 2015 09:53
I'm on a mac
ah, only main entry ponts?
Jari Pennanen
@Ciantic
May 06 2015 09:53
I think so, to the file defined in webpack.config.json
kpgarrod
@kpgarrod
May 06 2015 09:53
that I can live with :)
I'm trying it now, thanks
Jari Pennanen
@Ciantic
May 06 2015 09:54
it's a while since I got webpack + ts working so don't count on it :smile:
kpgarrod
@kpgarrod
May 06 2015 09:55
I have found some errors when I build in atom, so maybe when I fix those I will have more success
I'm getting several errors in node.d.ts. is that usual?
Jari Pennanen
@Ciantic
May 06 2015 10:01
running "tsc" ?
or what? The loaders are whole another issue here
I think they all embed the typescript compiler, so they need to be updated when TS is updated, which causes delay for them to be fixed when new TS is released. This time 1.5 got them really broken.
it would be nice to use atom to emit the TS -> JS and webpack for the outputted JS files. This way one wouldn't need the TS loaders at all!
not sure is it possible to use webpack with .js and .js.map (without the TS)
Jari Pennanen
@Ciantic
May 06 2015 10:14
Although, I need to use TS -> TS transpiler too, and atom or TS does not have such feature
kpgarrod
@kpgarrod
May 06 2015 10:14
@Ciantic. yes, I was thinking about doing it that way
Jari Pennanen
@Ciantic
May 06 2015 10:14
webpack can do that nicely with piping
correct that, atom-typescript doesn't have such feature :smile:
kpgarrod
@kpgarrod
May 06 2015 10:18
I don't think I need ts > ts transpiler
Jari Pennanen
@Ciantic
May 06 2015 10:18
it's a bit esoteric need, but I use ts-jsx-loader, which allows to write React.jsx(<MyJsx />) in TS syntax
which is then transpiled again to TS
and then fed to TS compiler
notice that I use TS not JSX in the TS, it's valid TS syntax here
James Brantly
@jbrantly
May 06 2015 13:53
@kpgarrod I think awesome-typescript-loader doesn't yet have support for tsconfig.json. That's why you need the <reference> in the entry points. Going forward from TS 1.5 I think best practice will be to use tsconfig.json for .d.ts files instead of <reference>.
kpgarrod
@kpgarrod
May 06 2015 14:25
@jbrantly: thanks. I am playing with using atom-typescript to do the compilation and using webPack to bundle the .js files. It seems like a less error-prone solution to me.

I can't say I'm finding it easy though :(. I'm getting an error:

Uncaught TypeError: webpack_require(...) is not a function

what does that mean?
Mike Graham
@cmichaelgraham
May 06 2015 14:27

:point_up: aurelia .d.ts files

sorry for the confusion, that folder is obselete (and now deleted).

this is the correct folder

you can see (as @csnover points out), the dts-generator is working properly :+1:
aurelia-http-client.d.ts

thank you @csnover for your efforts. dts-generator is very cool !!

kpgarrod
@kpgarrod
May 06 2015 14:27
sorry, I guess this is the wrong group for that question
I'm using this require syntax: require("./webSiteAppConfig")(webSiteApp);. It is valid in typescript isn't it?
Nelo Mitranim
@Mitranim
May 06 2015 14:36
@kpgarrod You might want to look into jspm + systemjs. They give you a complete ES6 module solution and jspm comes with bundling features
kpgarrod
@kpgarrod
May 06 2015 14:42
@Mitranim: are you saying the syntax I'm using isn't supported by typescript 1.5?
Nelo Mitranim
@Mitranim
May 06 2015 14:45
@kpgarrod Not really, I'm just suggesting to switch to a different transpilation workflow that doesn't depend on webpack loaders. You could pretranspile files using arbitrary tools (gulp plugins etc) and emit System modules, which can be bundled by jspm
We'll all have to switch to ES6 modules, might as well do this now if your current tooling isn't up to speed
But yeah this doesn't really answer your question so sorry for derailing :)