These are chat archives for TypeStrong/atom-typescript

23rd
Jun 2016
Moritz
@moritzuehling
Jun 23 2016 14:10
Hey guys, is there any way to disable the ctrl+click "Go to definition" feature?
When pasting something, I press control +left click almost at the same time, and then just press v afterwards. This is a "human race condition" for me, because sometimes I hold control and then click, which opens lib.d.ts (for example), which takes ages, and leads to me getting frustrated.
Moritz
@moritzuehling
Jun 23 2016 20:17
Oh wow, it came from the typescript-modules-helper, not from here
Consider it fixed :D
Ben
@eenblam
Jun 23 2016 21:40
Hmm. I've tried both atom-typescript and VS Code, and I can't seem to get type files (installed via typings) recognized.
From my tsconfig.json:
    "filesGlob": [
      "typings/**/*.d.ts",
      "typings/globals/**/*.d.ts",
      "typings/modules/**/*.d.ts"
    ]
Gustav Bylund
@Maistho
Jun 23 2016 21:43
@eenblam You should probably only add typings/index.d.t.s (if using typings 1.0)
Also where are the files located (is the tsconfig in the same folder as the typings directory)? Are the typings installed properly?
Ben
@eenblam
Jun 23 2016 21:45
  1. Yes 2. I installed via the command line. Not sure how to evaluate whether or not they installed properly, apart from not getting errors on installation.
Gustav Bylund
@Maistho
Jun 23 2016 21:45
ls typings ?
Blake Embrey
@blakeembrey
Jun 23 2016 21:45
@eenblam filesGlob is not an official property, it'll only work using atom
Ben
@eenblam
Jun 23 2016 21:46
@blakeembrey Right. I tried explicitly linking the files using "files" when using VS Code.
Blake Embrey
@blakeembrey
Jun 23 2016 21:46
ok, you only need a single reference to typings/index.d.ts
what was the error?
Ben
@eenblam
Jun 23 2016 21:46
@Maistho: globals/ index.d.ts modules/
Blake Embrey
@blakeembrey
Jun 23 2016 21:47
was it via vs code or atom or tsc?
Ben
@eenblam
Jun 23 2016 21:47
Yes, tried using only typings/idnex.d.ts, too.
One second
Blake Embrey
@blakeembrey
Jun 23 2016 21:48
which typings did you use?
if they were from typing install d3, they are external modules
not global
so the name d3 will not exist in scope
you should probably be getting d3 by doing import * as d3 from 'd3'
Ben
@eenblam
Jun 23 2016 21:51
Okay, so I should probably give context. I just started with TypeScript today. I went through most of the Handbook, and then I tried opening up a simple d3 app I'd written to figure out how to annotate it properly.
Okay, cool.
Gustav Bylund
@Maistho
Jun 23 2016 21:52
There's probably global typings for d3 as well
Ben
@eenblam
Jun 23 2016 21:52
That fixed d3, but RXJS (typings install rx) did install into globals yet isn't being found.
(even if I try importing)
Gustav Bylund
@Maistho
Jun 23 2016 21:54
rx probably needs to be included as well. I recall adding import 'rxjs/Rxjs' somewhere
Ben
@eenblam
Jun 23 2016 21:56
Tried import * as Rx from 'rx' and import 'rxjs/Rxjs'. Still can't find Rx.
Blake Embrey
@blakeembrey
Jun 23 2016 22:03
how did you install them from global? i'm going to assume it's this: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/rx/rx.d.ts
the correct way to import would be import rx = require('rx') (but import * as rx from 'rx' should also work)
make sure it's also installed
Ben
@eenblam
Jun 23 2016 22:05

I got this:

$ typings install dt~rx
typings ERR! message Attempted to compile "rx" as an external module, but it looks like a global module. You'll need to enable the global option to continue.

so I did this:

$ typings install dt~rx --global
typings INFO reference Stripped reference "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/rx/rx-lite.d.ts" during installation from "rx" (main)
rx
└── (No dependencies)
Blake Embrey
@blakeembrey
Jun 23 2016 22:08
yes, and there's a reference stripped during installation
so you can do typings install dt~rx-lite --global to correct that
it's an unfortunate problem with dependency management in the definitelytyped source
Ben
@eenblam
Jun 23 2016 22:10
Did so, still can't find 'Rx'
Blake Embrey
@blakeembrey
Jun 23 2016 22:11
rx lowercase
aside from that, it seems correct to me
can you make sure it's not just a restart of atom or something else required
try compiling with tsc?
Ben
@eenblam
Jun 23 2016 22:12
Restarted atom
Lowercase rx? I can't just import Rx = require('rx');?
Apparently not. This fixed it.
import rx = require('rx');
let Rx = rx;
(I had Rx.Observable.etc() in the original .js file.)
@blakeembrey Thanks for the help!
Blake Embrey
@blakeembrey
Jun 23 2016 22:18
that's really odd, the variable name causing shouldn't have mattered
glad you've got it working now :)
Ben
@eenblam
Jun 23 2016 22:18
Yeah, I'm super confused still, but I guess it's working.
The JS ecosystem as a whole is pretty new to me. I should probably read up CommonJS and on TypeScript's namespacing to get a better handle on what's going on here.