ES6 syntax for import/export doesn't work in ambient modules
Code to reproduce:
// File: external.d.ts
export interface IFoo {}
// File: ambient.d.ts
declare module "moduleA" {
import { IFoo } from "external"; // ERROR TS2307: Cannot find module 'external'.
}
Old syntax with require works fine:
// File: ambient.d.ts
declare module "moduleA" {
import ext = require("external");
import IFoo = ext.IFoo; // works
}
But I can't use require to export *. This is a problem (export = is not the same)
Tested in TS 1.5.3 and 1.6.2 with --module amd compiler option.
I can not repor this locally..
c:\test\5013>dir /B
ambient.d.ts
external.d.ts
c:\test\5013>type ambient.d.ts
// File: ambient.d.ts
declare module "moduleA" {
import { IFoo } from "external";
}
declare module "moduleB" {
import ext = require("external");
import IFoo = ext.IFoo;
}
c:\test\5013>type external.d.ts
// File: external.d.ts
export interface IFoo { }
c:\test\5013>tsc --version
message TS6029: Version 1.6.2
c:\test\5013>tsc ambient.d.ts external.d.ts --m amd
@mhegazy Remove declare module "moduleB" from ambient.d.ts
thanks. my bad. @vladima can you take a look.
@Koloto can you give tonight's typescript@next a try. the package is published to npm a little after 12:00 am PST.
@mhegazy, @vladima thanks, typescript@next works fine. Could you fix this in 1.6?
this will be in the next TypeScript release (TS 1.7).
When to wait next release?