From 9ab8a4f1fa1c27b2a70ca33c3cc3492c0bf7f58b Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Mon, 5 Nov 2018 15:21:38 -0800 Subject: [PATCH 1/2] Update decorator types Fixes #288 and #291 --- src/lib/decorators.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/decorators.ts b/src/lib/decorators.ts index 38e47a51..58272bbe 100644 --- a/src/lib/decorators.ts +++ b/src/lib/decorators.ts @@ -26,7 +26,7 @@ export type Constructor = { * * @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: * @@ -40,7 +40,7 @@ export type Constructor = { * } * */ -export const customElement = (tagName: keyof HTMLElementTagNameMap) => +export const customElement = (tagName: string) => (clazz: Constructor) => { window.customElements.define(tagName, clazz); // Cast as any because TS doesn't recognize the return type as being a @@ -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); }; From d18b1a0d983271b6a58cf1d86d6facbd862edb78 Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Mon, 5 Nov 2018 15:24:52 -0800 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 613724b6..74df9ec8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). Unreleased section, uncommenting the header as necessary. --> - +## 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)).