Skip to content

Commit

Permalink
Merge pull request #872 from reg-viz/remove_unused_type_decl
Browse files Browse the repository at this point in the history
Remove unused type decl
  • Loading branch information
Quramy committed Mar 29, 2024
2 parents 157fdd6 + 5c75a9f commit 2d88645
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 41 deletions.
41 changes: 1 addition & 40 deletions packages/storycap/decl/storybook.d.ts
Expand Up @@ -19,55 +19,16 @@ declare module '@storybook/manager-api' {

export const addons: Addons;
}

declare module '@storybook/preview-api' {
interface MakeDecorator {
(options: {
name: string;
parameterName: string;
skipIfNoParametersOrOptions: boolean;
allowDeprecatedUsage: boolean;
wrapper: (getStory: any, context: any, args: { parameters: any; options: any }) => any;
}): Function;
}

export const makeDecorator: MakeDecorator;
}
declare module '@storybook/addons' {
// eslint-disable-next-line no-duplicate-imports
import { EventEmitter } from 'events';
export interface API {
raw?: () => { id: string; kind: string; name: string }[];
getStorybook(): { kind: string; stories: { name: string }[] }[];
}

export interface StoryKind {
kind: string;
stories: string[];
}

export class Channel extends EventEmitter {
on(name: 'setStories', listener: (event: { stories: StoryKind[] }) => void): this;
once(name: 'setStories', listener: (event: { stories: StoryKind[] }) => void): this;
}

export interface Addons {
register(name: string, callback: (api: API) => void): void;
getChannel(): Channel;
}

interface MakeDecorator {
(options: {
name: string;
parameterName: string;
skipIfNoParametersOrOptions: boolean;
allowDeprecatedUsage: boolean;
wrapper: (getStory: any, context: any, args: { parameters: any; options: any }) => any;
}): Function;
}

// Note:
// Storybook v4 does not export makeDecorator function.
export const makeDecorator: MakeDecorator | undefined;

export const addons: Addons;
}
4 changes: 4 additions & 0 deletions packages/storycap/package.json
Expand Up @@ -93,6 +93,10 @@
"storycrawler": "^5.0.0-alpha.0",
"yargs": "^16.0.0"
},
"peerDependencies": {
"@storybook/manager-api": "^7.0.0 || ^8.0.0",
"@storybook/preview-api": "^7.0.0 || ^8.0.0"
},
"jest": {
"moduleFileExtensions": [
"ts",
Expand Down
1 change: 0 additions & 1 deletion packages/storycap/src/client/with-screenshot.ts
Expand Up @@ -6,7 +6,6 @@ const withScreenshotDecorator = makeDecorator({
name: 'withScreenshot',
parameterName: 'screenshot',
skipIfNoParametersOrOptions: false,
allowDeprecatedUsage: true,
wrapper: (getStory, context, { parameters, options }) => {
if (typeof process !== 'undefined' && process?.env.JEST_WORKER_ID !== undefined) {
return getStory(context);
Expand Down

0 comments on commit 2d88645

Please sign in to comment.