global.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /// <reference types="@tarojs/taro" />
  2. declare module '*.png';
  3. declare module '*.gif';
  4. declare module '*.jpg';
  5. declare module '*.jpeg';
  6. declare module '*.svg';
  7. declare module '*.css';
  8. declare module '*.less';
  9. declare module '*.scss';
  10. // declare module '*.sass';
  11. declare module '*.styl';
  12. declare namespace NodeJS {
  13. interface ProcessEnv {
  14. TARO_ENV: 'weapp' | 'swan' | 'alipay' | 'h5' | 'rn' | 'tt' | 'quickapp' | 'qq' | 'jd'
  15. }
  16. }
  17. declare namespace JSX {
  18. interface IntrinsicElements {
  19. custom: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & { props?: any }
  20. calendar: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>
  21. }
  22. }
  23. declare const wx
  24. declare namespace Taro {
  25. interface TaroStatic {
  26. $global: any
  27. }
  28. }
  29. type CustomPropsType = {
  30. adpId: number
  31. width?: number
  32. closeIcon?: boolean
  33. onEmitOpenMiniProgram(appId: string, path: string, extraData: { pqtId?: string }): void
  34. onError?(code: number): void
  35. onLoad?(): void
  36. onClose?(): void
  37. }
  38. type ConfigType = {
  39. header?: {},
  40. method?: 'GET' | 'POST',
  41. timeout?: number
  42. }
  43. type DataType = {
  44. [key: string]: any
  45. baseInfo?: object
  46. }
  47. type HttpInstanceType = {
  48. get(url: string, data?: {}, config?: ConfigType): Promise<any>
  49. post(url: string, data?: {}, config?: ConfigType): Promise<any>
  50. }
  51. interface RequestType {
  52. code: number,
  53. data: any,
  54. msg: string
  55. }