From 84a053ee94aa8e337fddf84ef3651246a382f9e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mu-An=20=E6=85=95=E5=AE=89?= Date: Tue, 2 Jun 2020 12:46:20 -0400 Subject: [PATCH] Apply suggestions from code review Co-authored-by: David Graham --- src/index.ts | 10 +++++----- tsconfig.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index 02aaa35..71ea84f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -50,11 +50,11 @@ export default class IncludeFragmentElement extends HTMLElement { this._attached = false } - static get observedAttributes() { + static get observedAttributes(): string[] { return ['src'] } - get src() { + get src(): string { const src = this.getAttribute('src') if (src) { const link = this.ownerDocument!.createElement('a') @@ -69,7 +69,7 @@ export default class IncludeFragmentElement extends HTMLElement { this.setAttribute('src', val) } - get accept() { + get accept(): string { return this.getAttribute('accept') || '' } @@ -77,11 +77,11 @@ export default class IncludeFragmentElement extends HTMLElement { this.setAttribute('accept', val) } - get data() { + get data(): Promise { return getData(this) } - attributeChangedCallback(attribute: string) { + attributeChangedCallback(attribute: string): void { if (attribute === 'src') { // Source changed after attached so replace element. if (this._attached) { diff --git a/tsconfig.json b/tsconfig.json index 55880a6..b30193c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "module": "esnext", + "module": "es2020", "target": "es2017", "strict": true, "declaration": true,