From d3d5f59c1664ac77d5404fa9e4f0303a527523d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Mon, 22 Jul 2019 14:04:01 +0100 Subject: [PATCH 1/4] only ship `dist/` folder in package --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 8340b47..e15862c 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,9 @@ "main": "dist/time-elements-legacy.js", "module": "dist/time-elements.js", "license": "MIT", + "files": [ + "dist" + ], "scripts": { "clean": "rm -rf dist", "lint": "github-lint", From 6fd77914470d9fa0640ece167bea3c9a51a0028c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Mon, 22 Jul 2019 14:04:58 +0100 Subject: [PATCH 2/4] add typescript definition file --- index.d.ts | 21 +++++++++++++++++++++ package.json | 4 +++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..f05b50c --- /dev/null +++ b/index.d.ts @@ -0,0 +1,21 @@ +class ExtendedTimeElement extends HTMLElement { + get date(): Date | undefined + getFormattedTitle(): string | undefined + getFormattedDate(): string | undefined +} + +export class LocalTimeElement extends ExtendedTimeElement { + getFormattedDate(): string | undefined +} + +export class RelativeTimeElement extends ExtendedTimeElement { + getFormattedDate(): string | undefined +} + +export class TimeAgoElement extends ExtendedTimeElement { + getFormattedDate(): string | undefined +} + +export class TimeUntilElement extends ExtendedTimeElement { + getFormattedDate(): string | undefined +} diff --git a/package.json b/package.json index e15862c..2fdef35 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,11 @@ "version": "3.0.3", "main": "dist/time-elements-legacy.js", "module": "dist/time-elements.js", + "types": "index.d.ts", "license": "MIT", "files": [ - "dist" + "dist", + "index.d.ts" ], "scripts": { "clean": "rm -rf dist", From 5358d12b59b42e02bf7377b7eaa6bb5fe5c76cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Wed, 24 Jul 2019 12:01:25 +0100 Subject: [PATCH 3/4] add missing declare keyword --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index f05b50c..5119cff 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,4 +1,4 @@ -class ExtendedTimeElement extends HTMLElement { +declare class ExtendedTimeElement extends HTMLElement { get date(): Date | undefined getFormattedTitle(): string | undefined getFormattedDate(): string | undefined From d2461826b443bc6e8fa3470086347de9b91ee852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Wed, 24 Jul 2019 12:01:52 +0100 Subject: [PATCH 4/4] change getter to a readonly property --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 5119cff..2dadf14 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,5 +1,5 @@ declare class ExtendedTimeElement extends HTMLElement { - get date(): Date | undefined + readonly date: Date | undefined getFormattedTitle(): string | undefined getFormattedDate(): string | undefined }