Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot alias imported behavior/mixin #106

Open
tpluscode opened this issue Aug 4, 2017 · 1 comment
Open

Cannot alias imported behavior/mixin #106

tpluscode opened this issue Aug 4, 2017 · 1 comment
Assignees
Labels

Comments

@tpluscode
Copy link
Contributor

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)) {}
@Buslowicz
Copy link
Owner

Should be fairly easy thing. Will do that when I get a moment.

@Buslowicz Buslowicz added the bug label Aug 4, 2017
@Buslowicz Buslowicz self-assigned this Aug 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants