Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 00:06
    github-actions[bot] closed #1550
  • Feb 19 00:50
    github-actions[bot] labeled #1566
  • Feb 09 08:02
    bennypowers closed #1573
  • Feb 08 08:25
    bennypowers edited #1573
  • Feb 08 08:22
    bennypowers opened #1573
  • Feb 04 06:02
    winston0410 opened #1572
  • Feb 02 15:10
    NodeJoSe edited #1571
  • Feb 02 15:09
    NodeJoSe opened #1571
  • Feb 02 00:10
    github-actions[bot] labeled #1550
  • Jan 15 00:34
    github-actions[bot] closed #1554
  • Jan 12 12:04
    RamoFX closed #1568
  • Jan 08 03:35
    aminya edited #1570
  • Jan 08 03:35
    aminya opened #1570
  • Jan 01 00:16
    github-actions[bot] labeled #1554
  • Dec 29 2020 09:23
    lierdakil closed #1569
  • Dec 29 2020 09:23
    lierdakil labeled #1569
  • Dec 27 2020 14:15
    Ppang0405 opened #1569
  • Dec 16 2020 13:08
    RamoFX edited #1568
  • Dec 15 2020 17:57
    RamoFX edited #1568
  • Dec 15 2020 15:42
    RamoFX edited #1568
Moritz
@moritzuehling
Oh wow, it came from the typescript-modules-helper, not from here
Consider it fixed :D
Ben
@eenblam
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
@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
  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
ls typings ?
Blake Embrey
@blakeembrey
@eenblam filesGlob is not an official property, it'll only work using atom
Ben
@eenblam
@blakeembrey Right. I tried explicitly linking the files using "files" when using VS Code.
Blake Embrey
@blakeembrey
ok, you only need a single reference to typings/index.d.ts
what was the error?
Ben
@eenblam
@Maistho: globals/ index.d.ts modules/
Blake Embrey
@blakeembrey
was it via vs code or atom or tsc?
Ben
@eenblam
Yes, tried using only typings/idnex.d.ts, too.
One second
Blake Embrey
@blakeembrey
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
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
There's probably global typings for d3 as well
Ben
@eenblam
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
rx probably needs to be included as well. I recall adding import 'rxjs/Rxjs' somewhere
Ben
@eenblam
Tried import * as Rx from 'rx' and import 'rxjs/Rxjs'. Still can't find Rx.
Blake Embrey
@blakeembrey
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

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
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
Did so, still can't find 'Rx'
Blake Embrey
@blakeembrey
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
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
that's really odd, the variable name causing shouldn't have mattered
glad you've got it working now :)
Ben
@eenblam
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.