123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- // Type definitions for [~THE LIBRARY NAME~] [~OPTIONAL VERSION NUMBER~]
- // Project: [~THE PROJECT NAME~]
- // Definitions by: [~YOUR NAME~] <[~A URL FOR YOU~]>
- // import EditorJS from "@editorjs/editorjs";
- /*~ If this library is callable (e.g. can be invoked as myLib(3)),
- *~ include those call signatures here.
- *~ Otherwise, delete this section.
- */
- // declare function myLib(a: string): string;
- // declare function myLib(a: number): number;
- // /*~ If you want the name of this library to be a valid type name,
- // *~ you can do so here.
- // *~
- // *~ For example, this allows us to write 'var x: myLib';
- // *~ Be sure this actually makes sense! If it doesn't, just
- // *~ delete this declaration and add types inside the namespace below.
- // */
- // interface myLib {
- // name: string;
- // length: number;
- // extras?: string[];
- // }
- // interface Window {
- // EditorJS: EditorJS;
- // }
- // TS有用。JS没用。
- // interface Window {
- // test: string;
- // }
- // declare var ee: EditorJS;
-
- // JS可用。 window.gee
- // declare global {
- // var gee: EditorJS;
- // // 或者
- // interface Window {
- // gtest: string;
- // }
- // }
- // /*~ If your library has properties exposed on a global variable,
- // *~ place them here.
- // *~ You should also place types (interfaces and type alias) here.
- // */
- // declare namespace myLib {
- // //~ We can write 'myLib.timeout = 50;'
- // let timeout: number;
- // //~ We can access 'myLib.version', but not change it
- // const version: string;
- // //~ There's some class we can create via 'let c = new myLib.Cat(42)'
- // //~ Or reference e.g. 'function f(c: myLib.Cat) { ... }
- // class Cat {
- // constructor(n: number);
- // //~ We can read 'c.age' from a 'Cat' instance
- // readonly age: number;
- // //~ We can invoke 'c.purr()' from a 'Cat' instance
- // purr(): void;
- // }
- // //~ We can declare a variable as
- // //~ 'var s: myLib.CatSettings = { weight: 5, name: "Maru" };'
- // interface CatSettings {
- // weight: number;
- // name: string;
- // tailLength?: number;
- // }
- // //~ We can write 'const v: myLib.VetID = 42;'
- // //~ or 'const v: myLib.VetID = "bob";'
- // type VetID = string | number;
- // //~ We can invoke 'myLib.checkCat(c)' or 'myLib.checkCat(c, v);'
- // function checkCat(c: Cat, s?: VetID);
- // }
- import Vue from "vue";
- import { AxiosInstance, AxiosRequestConfig } from "axios";
- // 可惜内部代码不能通过此类型推导
- //import * as api from "./api";
- declare module '*.vue' {
- import Vue from 'vue'
- export default Vue
- }
- declare module "vue/types/vue" {
- interface Vue {
- $http: AxiosInstance;
- // $api: api;
- /** @param cause "?cause=正常退出" */
- logout(cause?: string): Promise;
- /**
- * 会在 beforeDestory 中自动清除
- * @param {function} fn 要执行的函数
- * @param {number} interval 执行间隔ms
- */
- addInterval(fn: Function, interval: number): void;
- /**
- * 会在 beforeDestory 中自动清除
- * @param {function} fn 要执行的函数
- * @param {number} interval 执行间隔ms
- */
- addTimeout(fn: Function, interval: number): void;
- }
- }
- declare module "axios/index" {
- interface AxiosRequestConfig {
- noErrorMessage?: boolean | false;
- }
- }
|