Closed
Description
TypeScript Version: 3.8.0-dev.20191116
Search Terms:
- export namespace
- export merged namespace
- export namespace type
Code
a.ts:
export namespace Foo {
export class Bar {}
}
b.ts:
import {Foo as FooImpl} from './a.js'
export namespace Baz {
export const Foo = FooImpl
}
Expected behavior:
import {Baz} from './b.js'
let x: Baz.Foo.Bar // should compile without error
Actual behavior:
import {Baz} from './b.js'
let x: Baz.Foo.Bar // Error: Namespace '".../b".Baz' has no exported member 'Foo'.
let y = new Baz.Foo.Bar // Ok
Playground Link:
I am unsure how to use TypeScript Playground to import custom modules.
Related Issues:
- Merging constants with namespaces seems to be a fundamentally different issue, as there is a symbol conflict. Here that shouldn't be the case.
- Embedding types in namespace declarations also appears to be a different issue, as in this case it is the namespace itself not being recognised as a valid token in the type.
- Stack overflow question I raised in trying to determine if this is a bug or expected behaviour.