sentry-miniapp.d.ts 1.29 KB
// Type definitions for sentry-miniapp.js

// 导出所有Sentry相关的类型和函数
declare namespace Sentry {
  // 基本配置接口
  interface Options {
    dsn?: string;
    environment?: string;
    release?: string;
    debug?: boolean;
    [key: string]: any;
  }

  // 错误级别类型
  type SeverityLevel = 'fatal' | 'error' | 'warning' | 'log' | 'info' | 'debug';

  // 错误捕获和上报相关函数
  function init(options: Options): void;
  function captureException(error: Error | string, options?: any): string;
  function captureMessage(message: string, options?: any): string;
  function captureEvent(event: any): string;
  
  // 上下文相关函数
  function setTag(key: string, value: string): void;
  function setTags(tags: Record<string, string>): void;
  function setExtra(key: string, value: any): void;
  function setExtras(extras: Record<string, any>): void;
  function setUser(user: Record<string, any> | null): void;
  function setContext(name: string, context: Record<string, any> | null): void;

  // Scope相关函数
  function withScope(callback: (scope: any) => void): void;

  // 其他可能的辅助函数
  function addBreadcrumb(breadcrumb: any): void;
  function configureScope(callback: (scope: any) => void): void;
}

export = Sentry;
export as namespace Sentry;