I have multiple behaviors exported in same namespace:
// MixinOne.ts
export namespace Example {
export function MixinOne<T extends Constructor<{}>>(superClass: T) {
return class extends superClass { }
}
}
// MixinTwo.ts
export namespace Example {
export function MixinTwo<T extends Constructor<{}>>(superClass: T) {
return class extends superClass { }
}
}
It is not possible to >>correctly<< import both in one element's source by aliasing the namespace
import { Example as One } from './ExampleOne';
import { Example as Two } from './ExampleTwo';
export class ExampleElement extedns One.MixinOne(Two.MixinTwo(Polymer.Element)) {}
This will not work, because the alias is not correctly changed into the namespace. Instead of Example.MixinOne(Example.MixinTwo(Polymer.Element)) the aliases appear in generated output.
Not sure if's it's worth implementing this way although I don't think it's inherently bad to split the namespace this way.
A workaround is to import as but use the correct namespace and ignore TS errors/warning
export class ExampleElement extedns Example.MixinOne(Example.MixinTwo(Polymer.Element)) {}
I have multiple behaviors exported in same namespace:
It is not possible to >>correctly<< import both in one element's source by aliasing the namespace
This will not work, because the alias is not correctly changed into the namespace. Instead of
Example.MixinOne(Example.MixinTwo(Polymer.Element))
the aliases appear in generated output.Not sure if's it's worth implementing this way although I don't think it's inherently bad to split the namespace this way.
A workaround is to import as but use the correct namespace and ignore TS errors/warning