Skip to content

[ts2.6 regression] cannot name symbols referring to types using declare global #20749

@mprobst

Description

@mprobst

TypeScript Version: 2.6.2 & 2.7.0-dev.20171216

Code

// module.d.ts (from the AngularJS typings)
declare var angular: angular.IAngularStatic;

export = angular;
export as namespace angular;

declare namespace angular {
  export interface Module {}
  interface IAngularStatic {
    module(): Module;
  }
}

// globalize.d.ts
import * as alias from './module';

declare global {
  const angular: typeof alias;
}

// user.ts
export const foo = angular.module();

Compile with tsc --declaration

Expected behavior:

In TS2.5, this compiles fine, and produces a .d.ts with export const foo: angular.Module;, i.e. using the global alias for the module-scoped type.

Actual behavior:

In TS2.6+, this complains the symbol cannot be named:

user.ts(2,14): error TS4023: Exported variable 'foo' has or is using name 'angular.Module' from external module ".../module" but cannot be named.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts files

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions