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/browser2. 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 { ErrorEvent } from "@bugsly/browser";
Bugsly.init({
dsn: "https://your-dsn@bugsly.dev/1",
environment: "production",
tracesSampleRate: 1.0,
beforeSend(event: ErrorEvent) {
// 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. The error should show up as an issue within a few seconds.
Want to check your DSN before touching any code? From a macOS, Linux or WSL terminal, this sends one real error without any SDK (replace your-dsn with the key from your DSN):
curl -sS -X POST "https://bugsly.dev/api/1/envelope/" \
-H "X-Sentry-Auth: Sentry sentry_version=7, sentry_key=your-dsn" \
--data-binary $'{}\n{"type":"event"}\n{"level":"error","platform":"other","exception":{"values":[{"type":"CurlTestError","value":"Hello from my terminal"}]}}'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?
No. There is no separate @bugsly/types package. @bugsly/browser re-exports the Sentry browser SDK together with its TypeScript types, for example ErrorEvent as used above.
How do I upload source maps with TypeScript?
Bugsly accepts source maps uploaded with sentry-cli: set SENTRY_URL to https://bugsly.dev and authenticate with a Bugsly API token, then run sentry-cli sourcemaps upload on your build output.
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
The free plan includes 100 issues per month, 7-day retention and 10 AI requests per month. Paid plans start at $19/mo.
Start Free