From 0b79c40f3bbb828045cf9517b846eded220e1010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Tue, 2 Jul 2019 10:31:55 +0100 Subject: [PATCH 1/3] add typescript definition file --- index.d.ts | 4 ++++ package.json | 4 +++- 2 files changed, 7 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..183e0b7 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,4 @@ +export default class ImageCropElement extends HTMLElement { + src?: string + loaded?: boolean +} diff --git a/package.json b/package.json index 0ffc514..5ed532f 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,11 @@ "description": "Select area for cropping an image. This does not actually crop.", "main": "dist/index.umd.js", "module": "dist/index.esm.js", + "types": "index.d.ts", "files": [ "dist", - "index.css" + "index.css", + "index.d.ts" ], "scripts": { "clean": "rm -rf dist", From 45d293eecb99f2ff53c29d74df5c3a8930d927ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Fri, 16 Aug 2019 08:50:04 +0100 Subject: [PATCH 2/3] use union type for nullable types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Mu-An 慕安 --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 183e0b7..bfa1430 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,4 +1,4 @@ export default class ImageCropElement extends HTMLElement { - src?: string + src: string || null loaded?: boolean } From c676605259053beb2a5ad38c7fafdeac697b3ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Fri, 16 Aug 2019 08:50:26 +0100 Subject: [PATCH 3/3] loaded is not a nullable field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Mu-An 慕安 --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index bfa1430..f72281e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,4 +1,4 @@ export default class ImageCropElement extends HTMLElement { src: string || null - loaded?: boolean + loaded: boolean }