Skip to content

Commit

Permalink
Migrate addons/google-analytics to Typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetanmaisse committed Jan 20, 2019
1 parent 42052e1 commit c71c901
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion addons/google-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"url": "https://github.com/storybooks/storybook.git"
},
"license": "MIT",
"jsnext:main": "src/index.js",
"scripts": {
"prepare": "node ../../scripts/prepare.js"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { window } from 'global';
import addons from '@storybook/addons';
import { addons } from '@storybook/addons';
import { STORY_CHANGED, STORY_ERRORED, STORY_MISSING } from '@storybook/core-events';

import ReactGA from 'react-ga';
Expand All @@ -11,13 +11,13 @@ addons.register('storybook/google-analytics', api => {
const { url } = api.getUrlState();
ReactGA.pageview(url);
});
api.on(STORY_ERRORED, ({ description }) => {
api.on(STORY_ERRORED, ({ description }: { description: string }) => {
ReactGA.exception({
description,
fatal: true,
});
});
api.on(STORY_MISSING, ({ id }) => {
api.on(STORY_MISSING, ({ id }: { id: string }) => {
ReactGA.exception({
description: `attempted to render ${id}, but it is missing`,
fatal: false,
Expand Down
1 change: 1 addition & 0 deletions addons/google-analytics/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'global';

0 comments on commit c71c901

Please sign in to comment.