Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused type decl #872

Merged
merged 2 commits into from Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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