From dc44ac0c16e35a062fcba0a1f18651defab6bace Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Tue, 7 Mar 2023 17:12:33 +1100 Subject: [PATCH] Use `Of` type in `useOf` argument --- code/ui/blocks/src/blocks/Story.tsx | 1 + code/ui/blocks/src/blocks/useOf.ts | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/ui/blocks/src/blocks/Story.tsx b/code/ui/blocks/src/blocks/Story.tsx index 42d84ff90947..61864ef28828 100644 --- a/code/ui/blocks/src/blocks/Story.tsx +++ b/code/ui/blocks/src/blocks/Story.tsx @@ -115,6 +115,7 @@ export const getStoryId = (props: StoryProps, context: DocsContextProps): StoryI Please refer to the migration guide: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#story-block'`); } + console.log(props, 'of' in props); if (meta) context.referenceMeta(meta, false); const resolved = context.resolveOf(of || story || 'story', ['story']); return resolved.story.id; diff --git a/code/ui/blocks/src/blocks/useOf.ts b/code/ui/blocks/src/blocks/useOf.ts index 8e5d9d5f7a4f..8c2c55310029 100644 --- a/code/ui/blocks/src/blocks/useOf.ts +++ b/code/ui/blocks/src/blocks/useOf.ts @@ -1,6 +1,5 @@ import type { DocsContextProps, - ModuleExport, ResolvedModuleExportType, ResolvedModuleExportFromType, } from '@storybook/types'; @@ -16,7 +15,7 @@ export type Of = Parameters[0]; * if the resolved module is a component it will include the project annotations */ export const useOf = ( - moduleExportOrType: ModuleExport | TType, + moduleExportOrType: Of, validTypes?: TType[] ): ResolvedModuleExportFromType => { const context = useContext(DocsContext);