Reputation: 30671
Is there any way to export a class more than once in TypeScript?
The following works but the second export isn't treated as a class:
export module foo {
export class bar {
}
}
export var bar = foo.bar;
Is there a way to make both work:
import "foo"
class baz extends foo.bar {
}
and
import {bar} from "foo"
class baz extends bar {
}
Upvotes: 2
Views: 73
Reputation: 106640
The code is essentially the same as this:
class foo {
}
var bar = foo;
class baz extends bar { // error: cannot find name 'bar'
}
...which isn't supported by the language. Using a type alias won't work either.
The only workaround I can think of is to do this:
export module foo {
export class bar {
}
}
export class bar extends foo.bar {}
Upvotes: 1