From 73407126fc2b5229d50cb146b8dc5023922d4f59 Mon Sep 17 00:00:00 2001 From: tooppaaa Date: Thu, 6 Aug 2020 18:59:28 +0200 Subject: [PATCH 1/4] cli: apply types for angular --- app/angular/src/client/index.ts | 2 ++ app/angular/src/client/preview/types-6-0.ts | 23 +++++++++++++++++++ app/angular/src/types-6-0.d.ts | 1 + .../src/frameworks/angular/Button.stories.ts | 6 +++-- .../src/frameworks/angular/Header.stories.ts | 6 +++-- .../src/frameworks/angular/Page.stories.ts | 6 +++-- 6 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 app/angular/src/client/preview/types-6-0.ts create mode 100644 app/angular/src/types-6-0.d.ts diff --git a/app/angular/src/client/index.ts b/app/angular/src/client/index.ts index 823d2918762..384e8f440cb 100644 --- a/app/angular/src/client/index.ts +++ b/app/angular/src/client/index.ts @@ -9,6 +9,8 @@ export { raw, } from './preview'; +export * from './preview/types-6-0'; + export { StoryFnAngularReturnType as IStory } from './preview/types'; export { moduleMetadata } from './preview/angular/decorators'; diff --git a/app/angular/src/client/preview/types-6-0.ts b/app/angular/src/client/preview/types-6-0.ts new file mode 100644 index 00000000000..5f66f80955c --- /dev/null +++ b/app/angular/src/client/preview/types-6-0.ts @@ -0,0 +1,23 @@ +import { Args as DefaultArgs, Annotations, BaseMeta, BaseStory } from '@storybook/addons'; +import { StoryFnAngularReturnType } from './types'; + +export { Args, ArgTypes, Parameters, StoryContext } from '@storybook/addons'; + +type AngularComponent = any; +type AngularReturnType = StoryFnAngularReturnType; + +/** + * Metadata to configure the stories for a component. + * + * @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export) + */ +export type Meta = BaseMeta & + Annotations; + +/** + * Story function that represents a component example. + * + * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports) + */ +export type Story = BaseStory & + Annotations; diff --git a/app/angular/src/types-6-0.d.ts b/app/angular/src/types-6-0.d.ts new file mode 100644 index 00000000000..6ed7da8e519 --- /dev/null +++ b/app/angular/src/types-6-0.d.ts @@ -0,0 +1 @@ +export * from './dist/client/preview/types-6-0.d'; diff --git a/lib/cli/src/frameworks/angular/Button.stories.ts b/lib/cli/src/frameworks/angular/Button.stories.ts index 787e8d85cbd..feba4f551f7 100644 --- a/lib/cli/src/frameworks/angular/Button.stories.ts +++ b/lib/cli/src/frameworks/angular/Button.stories.ts @@ -1,3 +1,5 @@ +// also exported from '@storybook/angular' if you can deal with breaking changes in 6.1 +import { Story, Meta } from '@storybook/angular/types-6-0'; import Button from './button.component'; export default { @@ -6,9 +8,9 @@ export default { argTypes: { backgroundColor: { control: 'color' }, }, -}; +} as Meta; -const Template = (args: Button) => ({ +const Template: Story