From a85530d15a3ddfa9a8a04542f037e898ffc78c03 Mon Sep 17 00:00:00 2001 From: George Pickering <29524044+geopic@users.noreply.github.com> Date: Thu, 19 Nov 2020 23:37:57 +0000 Subject: [PATCH] fix(types): update / fix types declaration file --- package.json | 4 ++-- src/main.d.ts | 11 ----------- src/types.d.ts | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 13 deletions(-) delete mode 100644 src/main.d.ts create mode 100644 src/types.d.ts diff --git a/package.json b/package.json index bc64bb4..b3a83a0 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "private": false, "description": "1000+ Pixel-perfect svg icons for your next project as Vue components", "main": "dist/vue-unicons.common.js", + "types": "src/types.d.ts", "scripts": { "serve": "vue-cli-service serve", "build:libs": "npm run build && npm run build:ssr", @@ -72,6 +73,5 @@ "vue-cli-service lint", "git add" ] - }, - "types": "./src/main.d.ts" + } } diff --git a/src/main.d.ts b/src/main.d.ts deleted file mode 100644 index 6eba5c9..0000000 --- a/src/main.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* tslint:disable:only-arrow-functions */ -import { VueConstructor } from 'vue' - -declare module "vue-unicons" { - export function install(Vue: VueConstructor, options: object): void - export function add(icons: string[]): void -} - -declare module "vue-unicons/src/icons" { - export const icons: { name: string; path: string } -} diff --git a/src/types.d.ts b/src/types.d.ts new file mode 100644 index 0000000..fee7d0a --- /dev/null +++ b/src/types.d.ts @@ -0,0 +1,39 @@ +type UniconIcon = { + name: string + style: string + path: string +} + +type UniconOptions = { + fill: string + height: number + width: number +} + +declare module 'vue-unicons' { + import Vue from 'vue' + + interface VueUnicon { + add: (icons: UniconIcon[]) => void + install: (v: typeof Vue, options?: Partial) => void + } + + const Unicon: VueUnicon + + export default Unicon +} + +declare module 'vue-unicons/src/icons' + +declare module 'vue-unicons/dist/vue-unicons-ssr.common.js' { + import Vue from 'vue' + + interface VueUnicon { + add: (icons: UniconIcon[]) => void + install: (v: typeof Vue, options?: Partial) => void + } + + const Unicon: VueUnicon + + export default Unicon +}