From 38e2c6186ddd5ddb20096d5b9e0d0271732a2f47 Mon Sep 17 00:00:00 2001 From: Efren Aragon Date: Mon, 15 May 2023 23:02:21 -0400 Subject: [PATCH] fix: ts error on src/argTypes/docgen/typeScript folder --- .../src/argTypes/docgen/typeScript/createDefaultValue.ts | 2 +- .../src/argTypes/docgen/typeScript/createPropDef.test.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/lib/docs-tools/src/argTypes/docgen/typeScript/createDefaultValue.ts b/code/lib/docs-tools/src/argTypes/docgen/typeScript/createDefaultValue.ts index efbb1cb35f3e..79dc5bcc1c55 100644 --- a/code/lib/docs-tools/src/argTypes/docgen/typeScript/createDefaultValue.ts +++ b/code/lib/docs-tools/src/argTypes/docgen/typeScript/createDefaultValue.ts @@ -4,7 +4,7 @@ import type { DocgenInfo } from '../types'; import { createSummaryValue } from '../../utils'; import { isDefaultValueBlacklisted } from '../utils/defaultValue'; -export function createDefaultValue({ defaultValue }: DocgenInfo): PropDefaultValue { +export function createDefaultValue({ defaultValue }: DocgenInfo): PropDefaultValue | null { if (defaultValue != null) { const { value } = defaultValue; diff --git a/code/lib/docs-tools/src/argTypes/docgen/typeScript/createPropDef.test.ts b/code/lib/docs-tools/src/argTypes/docgen/typeScript/createPropDef.test.ts index 72dfad81c4a4..b8e1a3958902 100644 --- a/code/lib/docs-tools/src/argTypes/docgen/typeScript/createPropDef.test.ts +++ b/code/lib/docs-tools/src/argTypes/docgen/typeScript/createPropDef.test.ts @@ -8,7 +8,7 @@ function createDocgenInfo({ tsType, ...others }: Partial): DocgenInf tsType, required: true, ...others, - }; + } as DocgenInfo; } describe('type', () => { @@ -20,7 +20,7 @@ describe('type', () => { const { type } = createTsPropDef(PROP_NAME, docgenInfo); - expect(type.summary).toBe('string'); - expect(type.detail).toBeUndefined(); + expect(type?.summary).toBe('string'); + expect(type?.detail).toBeUndefined(); }); });