-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Typescript 3.1 - compile error. toggleAttribute type conflict in LegacyElementMixin #5364
Comments
See also #5307 |
After reviewing #5307, I do not believe Typescript supports interface unions like this. A admittedly messy fix would be for each element to inherit from a modified HTMLElement. Before
After
|
Just ran into this myself, too. In reality the method should be removed from the mixin, or at least we should update the typescript generator to exclude it from output. |
The problem is that our definition is different than the official one. Removing our TypeScript definition is therefore incorrect for those calling it the Polymer-way. However, now the project does not compile at all, so I think it is our only option 😢 |
yup 🙈 i didn't notice the extra parameter we have...
the third parameter is optional on our end, so maybe just returning |
Yes that is fine by me. |
Description
The following error is seen in typescript 3.1 when using any element with the LegacyElementMixin:
error TS2320: Interface 'AppDrawerElement' cannot simultaneously extend types 'LegacyElementMixin' and 'HTMLElement'. Named property 'toggleAttribute' of types 'LegacyElementMixin' and 'HTMLElement' are not identical.
It appears a new API for toggleAttribute was introduced with a signature
toggleAttribute(qualifiedName: string, force?: boolean): boolean;
this is in conflict with the existing method toggleAttribute in LegacyElementMixin with a signature oftoggleAttribute(name: string, bool?: boolean, node?: Element|null): void;
. The result is compilation errors when using Typescript 3.1 with Polymer.Live Demo
none
Versions
Polymer 2/3 typescript defs.
The text was updated successfully, but these errors were encountered: