From 1dfa5892e78c318084d05aba62e63987042a2322 Mon Sep 17 00:00:00 2001 From: Uri Shaked Date: Mon, 20 Jan 2020 12:54:49 +0200 Subject: [PATCH 1/2] fix(webcomponents): make types play nicely with lit-element Before this change, returning html`...` from `storiesOf(...).add` would result in the following error: Type 'TemplateResult' is not assignable to type 'StoryFnHtmlReturnType' --- app/web-components/src/client/preview/types.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/web-components/src/client/preview/types.ts b/app/web-components/src/client/preview/types.ts index 36432e1a4558..879879cd1d7c 100644 --- a/app/web-components/src/client/preview/types.ts +++ b/app/web-components/src/client/preview/types.ts @@ -1,6 +1,7 @@ import { StoryFn } from '@storybook/addons'; +import { TemplateResult, SVGTemplateResult } from 'lit-element'; -export type StoryFnHtmlReturnType = string | Node; +export type StoryFnHtmlReturnType = string | Node | TemplateResult | SVGTemplateResult; export interface IStorybookStory { name: string; From 2b95ec20db43e41bb000c6fc4208bbe07facabe8 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 21 Jan 2020 12:07:02 +0100 Subject: [PATCH 2/2] FIX linting --- app/web-components/src/client/preview/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/web-components/src/client/preview/types.ts b/app/web-components/src/client/preview/types.ts index 879879cd1d7c..f1fff195fe44 100644 --- a/app/web-components/src/client/preview/types.ts +++ b/app/web-components/src/client/preview/types.ts @@ -1,4 +1,5 @@ import { StoryFn } from '@storybook/addons'; +// eslint-disable-next-line import/no-extraneous-dependencies import { TemplateResult, SVGTemplateResult } from 'lit-element'; export type StoryFnHtmlReturnType = string | Node | TemplateResult | SVGTemplateResult;