From a71403dcd789b6bececd693e40a10412f4c35ea8 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Thu, 23 May 2024 19:16:07 +0200 Subject: [PATCH] Ensure correct type exports (#2) * Correctly export types * Ensure better type export name --- package.json | 22 +++++++++------------- src/components.tsx | 8 ++++---- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 84437c3..e6c1375 100644 --- a/package.json +++ b/package.json @@ -15,22 +15,12 @@ "test": "bun test", "prepare": "husky" }, - "files": [ - "dist" - ], + "files": ["dist"], "repository": "ronin-co/react-ronin", "homepage": "https://github.com/ronin-co/react-ronin", - "keywords": [ - "ronin", - "react", - "client", - "database", - "orm" - ], + "keywords": ["ronin", "react", "client", "database", "orm"], "lint-staged": { - "**/*": [ - "bunx @biomejs/biome format --write" - ] + "**/*": ["bunx @biomejs/biome format --write"] }, "exports": { ".": { @@ -44,6 +34,12 @@ "require": "./dist/components.js" } }, + "typesVersions": { + "*": { + "*": ["dist/index.d.ts"], + "components": ["dist/components.d.mts"] + } + }, "dependencies": { "ronin": "3.0.5" }, diff --git a/src/components.tsx b/src/components.tsx index 7824ea0..b4f8d14 100644 --- a/src/components.tsx +++ b/src/components.tsx @@ -2,7 +2,7 @@ import type { FunctionComponent, ReactHTML, ReactNode } from "react"; type ValueOf = T[keyof T]; -export type Content = +export type RichTextContent = | { type: | "doc" @@ -13,7 +13,7 @@ export type Content = | "listItem"; // If the node is empty in the editor, it won't have `content` set. For // example, you might add a new empty paragraph inside the editor. - content?: Content[]; + content?: RichTextContent[]; attrs: { language: string | null; }; @@ -33,7 +33,7 @@ export type Content = | { type: "heading"; // If the node is empty in the editor, it won't have `content` set. - content?: Content[]; + content?: RichTextContent[]; attrs: { level: 1 | 2 | 3 | 4; }; @@ -61,7 +61,7 @@ export const RichText = ({ data, components, }: { - data: Content | Content[]; + data: RichTextContent | RichTextContent[]; components?: ReactHTML; }) => { const items = Array.isArray(data) ? data : [data];