From ff3843d6f336d5341e83875ca9e9fdd2a599a775 Mon Sep 17 00:00:00 2001 From: Ben Vinegar Date: Thu, 7 Jul 2016 16:31:11 -0700 Subject: [PATCH 1/2] No default export for TypeScript bindings, instructions --- docs/integrations/angular2.rst | 2 +- typescript/raven-tests.ts | 6 +++--- typescript/raven.d.ts | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/integrations/angular2.rst b/docs/integrations/angular2.rst index 6be638c4b726..4e2d7f342873 100644 --- a/docs/integrations/angular2.rst +++ b/docs/integrations/angular2.rst @@ -52,7 +52,7 @@ Then, in your main application file (where ``bootstrap`` is called, e.g. main.ts .. code-block:: js - import Raven from 'raven-js'; + import Raven = require('raven-js'); import { bootstrap } from 'angular2/platform/browser'; import { MainApp } from './app.component'; import { provide, ExceptionHandler } from 'angular2/core'; diff --git a/typescript/raven-tests.ts b/typescript/raven-tests.ts index 8d35fcb608bc..f6eac0d21a57 100644 --- a/typescript/raven-tests.ts +++ b/typescript/raven-tests.ts @@ -1,8 +1,8 @@ -import Raven, {RavenOptions} from '..'; +import Raven = require('..'); Raven.config('https://public@getsentry.com/1').install(); -var options: RavenOptions = { +var options = { logger: 'my-logger', ignoreUrls: [ /graph\.facebook\.com/i, @@ -22,7 +22,7 @@ var options: RavenOptions = { ] }; -Raven.config('https://public@getsentry.com/1', 1).install(); +Raven.config('https://public@getsentry.com/1', options).install(); var throwsError = () => { throw new Error('broken'); diff --git a/typescript/raven.d.ts b/typescript/raven.d.ts index 12b8c8fc7321..99f3fbc02772 100644 --- a/typescript/raven.d.ts +++ b/typescript/raven.d.ts @@ -4,9 +4,9 @@ declare var Raven: RavenStatic; -export default Raven; +export = Raven; -export interface RavenOptions { +interface RavenOptions { /** The log level associated with this event. Default: error */ level?: string; @@ -54,7 +54,7 @@ export interface RavenOptions { transport?: (options: RavenTransportOptions) => void; } -export interface RavenStatic { +interface RavenStatic { /** Raven.js version. */ VERSION: string; From 4ae3cacd28d365569ddbe3c2820075d60f43cab4 Mon Sep 17 00:00:00 2001 From: Ben Vinegar Date: Thu, 7 Jul 2016 16:50:08 -0700 Subject: [PATCH 2/2] Add specific webpack instructions --- docs/integrations/angular2.rst | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/integrations/angular2.rst b/docs/integrations/angular2.rst index 4e2d7f342873..71537c5841bb 100644 --- a/docs/integrations/angular2.rst +++ b/docs/integrations/angular2.rst @@ -52,7 +52,7 @@ Then, in your main application file (where ``bootstrap`` is called, e.g. main.ts .. code-block:: js - import Raven = require('raven-js'); + import Raven from 'raven-js'; import { bootstrap } from 'angular2/platform/browser'; import { MainApp } from './app.component'; import { provide, ExceptionHandler } from 'angular2/core'; @@ -72,3 +72,14 @@ Then, in your main application file (where ``bootstrap`` is called, e.g. main.ts ]); Once you've completed these two steps, you are done. + +Webpack and Other Module Loaders +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In Webpack and other module loaders, you may need to use the require keyword to load Raven: + +.. code-block:: js + + import Raven = require('raven-js'); + .config('__PUBLIC_DSN__') + .install();