Skip to content

Commit

Permalink
fix: improve types export for astro 3 and typescript 5
Browse files Browse the repository at this point in the history
  • Loading branch information
jsve committed Oct 17, 2023
1 parent 41f732d commit 7be7425
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ To get the most basic functionality, add `RichText.astro` Storyblok component to

```js
---
import RichTextRenderer, { type RichTextType } from "storyblok-rich-text-astro-renderer/RichTextRenderer.astro";
import RichTextRenderer from "storyblok-rich-text-astro-renderer/RichTextRenderer.astro";
import type { RichTextType } from "storyblok-rich-text-astro-renderer"
import { storyblokEditable } from "@storyblok/astro";

export interface Props {
Expand Down
2 changes: 1 addition & 1 deletion demo/src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
import type { RichTextType } from "storyblok-rich-text-astro-renderer/RichTextRenderer.astro";
import type { RichTextType } from "storyblok-rich-text-astro-renderer";
import Layout from "../layouts/Layout.astro";
import StoryblokComponent from "@storyblok/astro/StoryblokComponent.astro";
Expand Down
4 changes: 1 addition & 3 deletions lib/RichTextRenderer.astro
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
import { resolveRichTextToNodes } from "./dist/index.mjs";
import { ComponentNode, Options, RichTextType } from "./dist/types";
export type { RichTextType };
import type { ComponentNode, Options, RichTextType } from "./dist/types";
export type Props = {
content: RichTextType;
Expand Down
2 changes: 2 additions & 0 deletions lib/RichTextRenderer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import RichTextRenderer from "./RichTextRenderer.astro";
export default RichTextRenderer;
11 changes: 8 additions & 3 deletions lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,21 @@
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/types/index.d.ts"
},
"./RichTextRenderer.astro": "./RichTextRenderer.astro"
"./RichTextRenderer.astro": {
"import": "./RichTextRenderer.astro",
"types": "./RichTextRenderer.ts"
}
},
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/types/index.d.ts",
"files": [
"dist",
"RichTextRenderer.astro"
"RichTextRenderer.astro",
"RichTextRenderer.ts"
],
"scripts": {
"build": "vite build",
Expand Down
3 changes: 2 additions & 1 deletion lib/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"compilerOptions": {
"module": "ESNext",
"target": "ESNext",
"strict": false
"strict": false,
"jsx": "preserve"
},
"extends": "astro/tsconfigs/base",
"$schema": "https://json.schemastore.org/tsconfig",
Expand Down

0 comments on commit 7be7425

Please sign in to comment.