Skip to content

Provide a way to alias namespaces #10187

@falsandtru

Description

@falsandtru

TypeScript should have a way to embed (type) namespaces. In the following case, assigned (embeded) namespace NS.A should have a C type.

TypeScript Version: master

Code

namespace NS_A {
  export class C {
  }
}
namespace NS {
  export var A = NS_A;
  export type A = NS_A;
}
var C = NS.A.C;
type C = NS.A.C;

Expected behavior:

$ node built/local/tsc.js --lib es6 -m commonjs --noEmit index.ts

Actual behavior:

$ node built/local/tsc.js --lib es6 -m commonjs --noEmit index.ts
index.ts(7,19): error TS2304: Cannot find name 'NS_A'.
index.ts(10,13): error TS2305: Module 'NS' has no exported member 'A'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs More InfoThe issue still hasn't been fully clarifiedSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions