From ae79fd6d09ae7045d96cf6175173f0a29d9a9be9 Mon Sep 17 00:00:00 2001 From: Angelo Ashmore Date: Wed, 24 Nov 2021 08:58:25 -1000 Subject: [PATCH] feat: re-export Element from `@prismicio/richtext` This makes writing a Rich Text serializer easier. --- src/index.ts | 8 ++++++++ test/index.test.ts | 13 +++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 test/index.test.ts diff --git a/src/index.ts b/src/index.ts index 04d9c86..7864099 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,6 +17,14 @@ export type { PrismicTextProps } from "./PrismicText"; export { PrismicRichText } from "./PrismicRichText"; export type { PrismicRichTextProps } from "./PrismicRichText"; +import { Element } from "@prismicio/richtext"; +export { Element }; +/** + * @deprecated Renamed to `Element` (without an "s"). + */ +// TODO: Remove in v3. +export const Elements = Element; + export { SliceZone, TODOSliceComponent } from "./SliceZone"; export type { SliceComponentProps, diff --git a/test/index.test.ts b/test/index.test.ts new file mode 100644 index 0000000..697cbd7 --- /dev/null +++ b/test/index.test.ts @@ -0,0 +1,13 @@ +import test from "ava"; +import * as prismicR from "@prismicio/richtext"; + +import * as prismicH from "../src"; + +test("Element is an alias for @prismicio/richtext's Element", (t) => { + t.is(prismicH.Element, prismicR.Element); +}); + +// TODO: Remove in v3. +test("Elements is a temporary alias for Element", (t) => { + t.is(prismicH.Elements, prismicH.Element); +});