diff --git a/code/frameworks/ember/src/client/preview/types.ts b/code/frameworks/ember/src/client/preview/types.ts index 29cfbcd153a..711a54f46bd 100644 --- a/code/frameworks/ember/src/client/preview/types.ts +++ b/code/frameworks/ember/src/client/preview/types.ts @@ -1,3 +1,5 @@ +import type { Framework } from '@storybook/types'; + export type { RenderContext } from '@storybook/types'; export interface ShowErrorArgs { @@ -11,7 +13,7 @@ export interface OptionsArgs { element: any; } -export type EmberFramework = { +export interface EmberFramework extends Framework { component: any; storyResult: OptionsArgs; -}; +} diff --git a/code/renderers/html/src/types.ts b/code/renderers/html/src/types.ts index e022dda9d0a..6814ea3634a 100644 --- a/code/renderers/html/src/types.ts +++ b/code/renderers/html/src/types.ts @@ -1,4 +1,4 @@ -import type { ArgsStoryFn, StoryContext as DefaultStoryContext } from '@storybook/types'; +import type { ArgsStoryFn, Framework, StoryContext as DefaultStoryContext } from '@storybook/types'; import type { parameters } from './config'; @@ -11,10 +11,10 @@ export interface ShowErrorArgs { description: string; } -export type HtmlFramework = { +export interface HtmlFramework extends Framework { component: string | HTMLElement | ArgsStoryFn; storyResult: StoryFnHtmlReturnType; -}; +} export type StoryContext = DefaultStoryContext & { parameters: DefaultStoryContext['parameters'] & typeof parameters; diff --git a/code/renderers/preact/src/types.ts b/code/renderers/preact/src/types.ts index 281f995d70a..0a17f5f3ef9 100644 --- a/code/renderers/preact/src/types.ts +++ b/code/renderers/preact/src/types.ts @@ -1,3 +1,4 @@ +import type { Framework } from '@storybook/types'; import type { AnyComponent } from 'preact'; export type { RenderContext } from '@storybook/types'; @@ -9,7 +10,7 @@ export interface ShowErrorArgs { description: string; } -export type PreactFramework = { +export interface PreactFramework extends Framework { component: AnyComponent; storyResult: StoryFnPreactReturnType; -}; +} diff --git a/code/renderers/react/src/types.ts b/code/renderers/react/src/types.ts index f9ac2fe4503..22302994497 100644 --- a/code/renderers/react/src/types.ts +++ b/code/renderers/react/src/types.ts @@ -1,10 +1,10 @@ import type { ComponentType, ReactElement } from 'react'; -import type { AnyFramework } from '@storybook/types'; +import type { Framework } from '@storybook/types'; export type { Store_RenderContext as RenderContext } from '@storybook/types'; export type { StoryContext } from '@storybook/types'; -export interface ReactFramework extends AnyFramework { +export interface ReactFramework extends Framework { component: ComponentType; storyResult: StoryFnReactReturnType; } diff --git a/code/renderers/server/src/types.ts b/code/renderers/server/src/types.ts index decf1ddd21c..9e61968468d 100644 --- a/code/renderers/server/src/types.ts +++ b/code/renderers/server/src/types.ts @@ -1,14 +1,14 @@ -import type { StoryContext as StoryContextBase } from '@storybook/types'; +import type { Framework, StoryContext as StoryContextBase } from '@storybook/types'; export type { RenderContext } from '@storybook/types'; export type StoryFnServerReturnType = any; export type StoryContext = StoryContextBase; -export type ServerFramework = { +export interface ServerFramework extends Framework { component: string; storyResult: StoryFnServerReturnType; -}; +} export type FetchStoryHtmlType = ( url: string, diff --git a/code/renderers/svelte/src/types.ts b/code/renderers/svelte/src/types.ts index 32f25dbab05..84ae92d4879 100644 --- a/code/renderers/svelte/src/types.ts +++ b/code/renderers/svelte/src/types.ts @@ -1,4 +1,4 @@ -import type { AnyFramework, StoryContext as StoryContextBase } from '@storybook/types'; +import type { Framework, StoryContext as StoryContextBase } from '@storybook/types'; import type { ComponentConstructorOptions, ComponentEvents, SvelteComponentTyped } from 'svelte'; export type StoryContext = StoryContextBase; @@ -32,7 +32,7 @@ type ComponentType< }; export interface SvelteFramework - extends AnyFramework { + extends Framework { component: ComponentType ? this['T'] : any>; storyResult: this['T'] extends Record ? SvelteStoryResult> diff --git a/code/renderers/vue/src/types.ts b/code/renderers/vue/src/types.ts index 22621b94637..976bfd43775 100644 --- a/code/renderers/vue/src/types.ts +++ b/code/renderers/vue/src/types.ts @@ -1,4 +1,4 @@ -import type { StoryContext as StoryContextBase } from '@storybook/types'; +import type { Framework, StoryContext as StoryContextBase } from '@storybook/types'; import type { Component, AsyncComponent } from 'vue'; export type { RenderContext } from '@storybook/types'; @@ -14,7 +14,7 @@ export type StoryFnVueReturnType = export type StoryContext = StoryContextBase; -export type VueFramework = { +export interface VueFramework extends Framework { component: Component | AsyncComponent; storyResult: StoryFnVueReturnType; -}; +} diff --git a/code/renderers/vue3/src/types.ts b/code/renderers/vue3/src/types.ts index 04d9a10f01f..009309d82ac 100644 --- a/code/renderers/vue3/src/types.ts +++ b/code/renderers/vue3/src/types.ts @@ -1,4 +1,4 @@ -import type { AnyFramework, StoryContext as StoryContextBase } from '@storybook/types'; +import type { Framework, StoryContext as StoryContextBase } from '@storybook/types'; import type { ConcreteComponent } from 'vue'; export type { RenderContext } from '@storybook/types'; @@ -12,7 +12,7 @@ export type StoryFnVueReturnType = ConcreteComponent; export type StoryContext = StoryContextBase; -export interface VueFramework extends AnyFramework { +export interface VueFramework extends Framework { // We are omitting props, as we don't use it internally, and more importantly, it completely changes the assignability of meta.component. // Try not omitting, and check the type errros in the test file, if you want to learn more. component: Omit, 'props'>; diff --git a/code/renderers/web-components/src/types.ts b/code/renderers/web-components/src/types.ts index 3c01fc6f0a2..a33f9cfb260 100644 --- a/code/renderers/web-components/src/types.ts +++ b/code/renderers/web-components/src/types.ts @@ -1,14 +1,14 @@ -import type { StoryContext as StoryContextBase } from '@storybook/types'; +import type { Framework, StoryContext as StoryContextBase } from '@storybook/types'; import type { TemplateResult, SVGTemplateResult } from 'lit-html'; export type StoryFnHtmlReturnType = string | Node | TemplateResult | SVGTemplateResult; export type StoryContext = StoryContextBase; -export type WebComponentsFramework = { +export interface WebComponentsFramework extends Framework { component: string; storyResult: StoryFnHtmlReturnType; -}; +} export interface ShowErrorArgs { title: string;