Set Up Bugsly for TypeScript
Type-safe error tracking for any TypeScript project with full type definitions, source map support, and intelligent error grouping.
1. Install the SDK
npm install @bugsly/browser @bugsly/types2. Configure Bugsly
Add the following to your application entry point. Replace the DSN with your project DSN from the Bugsly dashboard.
import * as Bugsly from "@bugsly/browser";
import type { BugslyEvent } from "@bugsly/types";
Bugsly.init({
dsn: "https://your-dsn@bugsly.dev/1",
environment: "production",
tracesSampleRate: 1.0,
beforeSend(event: BugslyEvent) {
// Type-safe event filtering
if (event.exception?.values?.[0]?.type === "ChunkLoadError") {
return null; // Don't send chunk load errors
}
return event;
},
});
// Typed error capture
Bugsly.captureException(new Error("Typed error"));
Bugsly.setContext("order", { id: 123, total: 49.99 });3. Verify It Works
Trigger a test error in your application and check your Bugsly dashboard. You should see the error appear within seconds, complete with stack trace, breadcrumbs, and AI-powered analysis.
What You Get with TypeScript
- Full TypeScript definitions for all SDK APIs
- Source map upload for readable stack traces in production
- Type-safe event filtering and enrichment via beforeSend
- Intelligent error grouping that understands TS patterns
- Compatible with all major bundlers (Vite, webpack, esbuild)
- AI analysis that understands TypeScript-specific errors
Frequently Asked Questions
Do I need @bugsly/types separately?
@bugsly/browser includes basic types, but @bugsly/types provides additional type definitions for advanced use cases like custom integrations, event processors, and transport implementations.
How do I upload source maps with TypeScript?
Use the @bugsly/bundler-plugin for your build tool (Vite, webpack, Rollup, or esbuild). It automatically uploads source maps during your build process.
Does Bugsly support TypeScript path aliases?
Yes. As long as your bundler resolves the aliases, Bugsly's source maps will correctly map stack traces to your original TypeScript source files.
Start tracking errors in TypeScript for free
Get AI-powered error analysis, session replay, and performance monitoring — included free on every plan.
Start Free