global.d.ts 787 B

123456789101112131415161718192021222324252627282930313233
  1. // 声明一个模块,防止引入文件时报错
  2. declare module "*.json";
  3. declare module "*.png";
  4. declare module "*.jpg";
  5. declare module "*.scss";
  6. declare module "*.ts";
  7. declare module "*.js";
  8. // 声明文件,*.vue 后缀的文件交给 vue 模块来处理
  9. declare module "*.vue" {
  10. import type { DefineComponent } from "vue";
  11. const component: DefineComponent<{}, {}, any>;
  12. export default component;
  13. }
  14. // 声明 ref
  15. declare type RefType<T = any> = T | null;
  16. // 声明 HTMLElement
  17. declare type HtmlType = HTMLElement | string | undefined | null;
  18. // 申明 children 可选
  19. declare type ChildType<T = any> = {
  20. children?: T[];
  21. };
  22. // 申明 数组
  23. declare type EmptyArrayType<T = any> = T[];
  24. // 申明 对象
  25. declare type EmptyObjectType<T = any> = {
  26. [key: string]: T;
  27. };