sjrd/scala-js-ts-importer

error with import inside declared module

Closed this issue · 2 comments

Hi..sorry but I'm trying convert the atom.d.ts from definitelytyped

when I run the importer I get an error in the line 1263:

  Parse error at 1263.2
  ``}'' expected but `import' found
     import spacePen = require("space-pen");

      ^

seems than to the importer doesnt like that import clause inside a module declaration...this is the code

  declare var atom:AtomCore.IAtom;

  declare module "atom" {
     import spacePen = require("space-pen"); // <----here is the problem!!

     var $:typeof spacePen.$; 

I'm not so much familiar with typescript and I don't know how fix it by hand..can you give me a clue??..thanks

sjrd commented

Imports are ignored anyway, so as a workaround you can simply manually delete that import statement.

That said, the following line will likely fail as well. I didn't know typeof could be used that way in TypeScript. You'll have to put a different type to process the import. Afterwards you can edit the Scala code and write spacePen.$.type.

Looks like a type alias to me.