From b13ced295ff8aaa75fe00fec3ef9b4d48d252426 Mon Sep 17 00:00:00 2001 From: Kasper Peulen Date: Wed, 26 Jun 2024 17:14:21 +0200 Subject: [PATCH 1/3] Fix types to interfaces --- src/story.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/story.ts b/src/story.ts index 1b0c5b9..2eaf9a5 100644 --- a/src/story.ts +++ b/src/story.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-empty-interface */ import type { RemoveIndexSignature, Simplify, UnionToIntersection } from 'type-fest'; import type { SBScalarType, SBType } from './SBType'; @@ -273,16 +274,12 @@ export interface StoryContext = StoryContext; +export interface StoryContextForLoaders + extends StoryContext {} /** @deprecated Use {@link StoryContext} instead. */ -export type PlayFunctionContext = StoryContext< - TRenderer, - TArgs ->; +export interface PlayFunctionContext + extends StoryContext {} export type StepLabel = string; From d6ab1d5045cc37876c327139be79c93444653b77 Mon Sep 17 00:00:00 2001 From: Kasper Peulen Date: Wed, 26 Jun 2024 17:16:20 +0200 Subject: [PATCH 2/3] Add canvas property to context that can be implemented by addons such as @storybook/test --- src/story.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/story.ts b/src/story.ts index 2eaf9a5..f98d2e4 100644 --- a/src/story.ts +++ b/src/story.ts @@ -260,6 +260,8 @@ export type BeforeEach = ( context: StoryContext ) => Awaitable; +export interface Canvas {} + export interface StoryContext extends StoryContextForEnhancers, Required> { @@ -271,6 +273,7 @@ export interface StoryContext; context: this; + canvas: Canvas; } /** @deprecated Use {@link StoryContext} instead. */ From ba767850ebb52f8a3bf2bdafca6bc9c521dc750f Mon Sep 17 00:00:00 2001 From: Kasper Peulen Date: Thu, 27 Jun 2024 11:12:54 +0200 Subject: [PATCH 3/3] Disable unnecessary eslint rule --- package.json | 1 + src/story.ts | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b38ce45..ba64d01 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "@storybook/eslint-config-storybook" ], "rules": { + "@typescript-eslint/no-empty-interface": "off", "import/no-unresolved": "error", "jest/expect-expect": [ "warn", diff --git a/src/story.ts b/src/story.ts index f98d2e4..424edf1 100644 --- a/src/story.ts +++ b/src/story.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-empty-interface */ import type { RemoveIndexSignature, Simplify, UnionToIntersection } from 'type-fest'; import type { SBScalarType, SBType } from './SBType';