Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Aug 21, 2023
1 parent d970053 commit 7192433
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions code/lib/preview/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ const getKeys = Object.keys as <T extends object>(obj: T) => Array<keyof T>;

// Apply all the globals
getKeys(globals).forEach((key) => {
(globalThis as any)[globals[key]] = values[key];
(global as any)[globals[key]] = values[key];
});

global.sendTelemetryError = (error) => {
global.sendTelemetryError = (error: any) => {
const channel = global.__STORYBOOK_ADDONS_CHANNEL__;
channel.emit(TELEMETRY_ERROR, error);
};

// handle all uncaught StorybookError at the root of the application and log to telemetry if applicable
global.addEventListener('error', (args) => {
global.addEventListener('error', (args: any) => {
const error = args.error || args;
if (error.fromStorybook) {
global.sendTelemetryError(error);
}
});
global.addEventListener('unhandledrejection', ({ reason }) => {
global.addEventListener('unhandledrejection', ({ reason }: any) => {
if (reason.fromStorybook) {
global.sendTelemetryError(reason);
}
Expand Down

0 comments on commit 7192433

Please sign in to comment.