From c35bda1d1a0c4527108d7b00bee92673e3f9c0d0 Mon Sep 17 00:00:00 2001 From: Eliot Partridge Date: Thu, 26 Sep 2019 20:43:21 -0500 Subject: [PATCH] Add proper TypeScript definitions --- assortment__darkmodejs.d.ts | 5 ----- index.d.ts | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) delete mode 100644 assortment__darkmodejs.d.ts create mode 100644 index.d.ts diff --git a/assortment__darkmodejs.d.ts b/assortment__darkmodejs.d.ts deleted file mode 100644 index c1e4052..0000000 --- a/assortment__darkmodejs.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare module "@assortment/darkmodejs" { - export = assortment__darkmodejs; - - declare function assortment__darkmodejs({ onChange = () => {} }: any): any; -} diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..2794e7b --- /dev/null +++ b/index.d.ts @@ -0,0 +1,18 @@ +declare enum Theme { + DARK = 'dark', + LIGHT = 'light', + NO_PREF = 'no-preference', + NO_SUPP = 'no-support' +} + +interface Config { + onChange: (activeTheme: Theme, themes: typeof Theme) => void; +} + +interface DarkModeJS { + removeListeners: () => void; +} + +declare function darkmodejs(config: Config): DarkModeJS; + +export = darkmodejs;