From c155b189b48dae33897c26a09cb550fae4bdd83f Mon Sep 17 00:00:00 2001 From: Alex Wilson Date: Sun, 13 Oct 2019 19:40:33 -0400 Subject: [PATCH 1/2] Update index.ts of jest addon to make withTests type generic --- addons/jest/src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/jest/src/index.ts b/addons/jest/src/index.ts index 624c3d43aa26..24fd1ef4dfa0 100644 --- a/addons/jest/src/index.ts +++ b/addons/jest/src/index.ts @@ -51,15 +51,15 @@ const emitAddTests = ({ kind, story, testFiles, options }: EmitAddTestsArg) => { export const withTests = (userOptions: { results: any; filesExt?: string; -}): DecoratorFunction => { +}) => { const defaultOptions = { filesExt: '((\\.specs?)|(\\.tests?))?(\\.[jt]sx?)?$', }; const options = { ...defaultOptions, ...userOptions }; - return (...args) => { + return (...args: any []) => { if (typeof args[0] === 'string') { - return deprecate((storyFn: StoryFn, { kind }: Parameters) => { + return deprecate((storyFn: StoryFn, { kind }: Parameters) => { emitAddTests({ kind, story: storyFn, testFiles: (args as any) as string[], options }); return storyFn(); From 63bf744be79ee1269b6b9574fe32c5acabd0752c Mon Sep 17 00:00:00 2001 From: Alex Wilson Date: Sun, 13 Oct 2019 19:45:05 -0400 Subject: [PATCH 2/2] Remove unused DecoratorFunction from jest index file --- addons/jest/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/jest/src/index.ts b/addons/jest/src/index.ts index 24fd1ef4dfa0..aeff428c6ff7 100644 --- a/addons/jest/src/index.ts +++ b/addons/jest/src/index.ts @@ -1,4 +1,4 @@ -import addons, { Parameters, DecoratorFunction, StoryFn } from '@storybook/addons'; +import addons, { Parameters, StoryFn } from '@storybook/addons'; import deprecate from 'util-deprecate'; import { normalize, sep } from 'upath'; import { ADD_TESTS } from './shared';