From 85eed4945c6b04b30ca49f01ea240246d242455b Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Fri, 31 Jan 2025 16:47:42 +0100 Subject: [PATCH] Stop exporting types (#2) --- src/components/image.client.tsx | 2 +- src/components/rich-text.tsx | 15 +++++++-------- src/index.ts | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/components/image.client.tsx b/src/components/image.client.tsx index 1b2b6bc..2834b6e 100644 --- a/src/components/image.client.tsx +++ b/src/components/image.client.tsx @@ -5,7 +5,7 @@ import { forwardRef, useCallback, useRef } from 'react'; const supportedFitValues = ['fill', 'contain', 'cover']; -export interface ImageProps { +interface ImageProps { /** * Defines text that can replace the image in the page. */ diff --git a/src/components/rich-text.tsx b/src/components/rich-text.tsx index 7a2bcbf..32c7c8c 100644 --- a/src/components/rich-text.tsx +++ b/src/components/rich-text.tsx @@ -2,7 +2,7 @@ import type { FunctionComponent, ReactHTML, ReactNode } from 'react'; type ValueOf = T[keyof T]; -export type RichTextContent = +type RichTextContent = | { type: | 'doc' @@ -58,14 +58,13 @@ export type RichTextContent = )[]; }; -export const RichText = ({ - data, - components, -}: { - data: RichTextContent | RichTextContent[]; +interface RichTextProps { + data: unknown; components?: ReactHTML; -}) => { - const items = Array.isArray(data) ? data : [data]; +} + +export const RichText = ({ data, components }: RichTextProps) => { + const items: RichTextContent[] = Array.isArray(data) ? data : [data]; return items.map((item, position) => { if (item.type === 'text') { diff --git a/src/index.ts b/src/index.ts index 54ae260..e467f23 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -export { RichText, type RichTextContent } from '@/src/components/rich-text'; +export { RichText } from '@/src/components/rich-text'; export { Image } from '@/src/components/image.client'; export * from 'ronin';