Browse Source

声明全局

xia 4 years ago
parent
commit
9241236065
2 changed files with 22 additions and 0 deletions
  1. 15 0
      src/types/global.d.ts
  2. 7 0
      src/types/window.d.ts

+ 15 - 0
src/types/global.d.ts

@@ -0,0 +1,15 @@
+declare interface Fn<T = any> {
+  (...arg: T[]): T;
+}
+
+declare interface IObj<T = any> {
+  [key: string]: T;
+  [key: number]: T;
+}
+
+declare type SelectOptions = {
+  label: string;
+  value: any;
+}[];
+
+declare type EmitType = (event: string, ...args: any[]) => void;

+ 7 - 0
src/types/window.d.ts

@@ -0,0 +1,7 @@
+import type { App } from 'vue';
+
+declare global {
+  declare interface Window {
+    __APP__: App<Element>;
+  }
+}