global.d.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. openEmbeddedMiniProgram(appId: string, path: string): void
  33. onError?(params: { message: string, code: number}): void
  34. onLoad?(): void
  35. onClose?(): void
  36. }
  37. type ConfigType = {
  38. header?: {},
  39. method?: 'GET' | 'POST',
  40. timeout?: number
  41. }
  42. type DataType = {
  43. [key: string]: any
  44. baseInfo?: object
  45. }
  46. type HttpInstanceType = {
  47. get(url: string, data?: {}, config?: ConfigType): Promise<any>
  48. post(url: string, data?: {}, config?: ConfigType): Promise<any>
  49. }
  50. interface RequestType {
  51. code: number,
  52. data: any,
  53. msg: string
  54. }