Skip to content

Commit

Permalink
Merge pull request #292 from Polymer/decorator-types
Browse files Browse the repository at this point in the history
Update decorator types
  • Loading branch information
Steve Orvell committed Dec 12, 2018
2 parents bf298ce + d18b1a0 commit 01d51c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
Unreleased section, uncommenting the header as necessary.
-->

<!-- ## Unreleased -->
## Unreleased
* Types for the `property` and `customElement` decorators updated ([#288](https://github.com/Polymer/lit-element/issues/288) and [#291](https://github.com/Polymer/lit-element/issues/291)).

<!-- ### Changed -->
<!-- ### Added -->
Expand Down
6 changes: 3 additions & 3 deletions src/lib/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type Constructor<T> = {
*
* @param tagName the name of the custom element to define
*
* In TypeScript, the `tagName` passed to `customElement` must be a key of the
* In TypeScript, the `tagName` passed to `customElement` should be a key of the
* `HTMLElementTagNameMap` interface. To add your element to the interface,
* declare the interface in this module:
*
Expand All @@ -40,7 +40,7 @@ export type Constructor<T> = {
* }
*
*/
export const customElement = (tagName: keyof HTMLElementTagNameMap) =>
export const customElement = (tagName: string) =>
(clazz: Constructor<HTMLElement>) => {
window.customElements.define(tagName, clazz);
// Cast as any because TS doesn't recognize the return type as being a
Expand All @@ -56,7 +56,7 @@ export const customElement = (tagName: keyof HTMLElementTagNameMap) =>
* supplied to configure property features.
*/
export const property = (options?: PropertyDeclaration) => (proto: Object,
name: string) => {
name: PropertyKey) => {
(proto.constructor as typeof UpdatingElement).createProperty(name, options);
};

Expand Down

0 comments on commit 01d51c8

Please sign in to comment.