@prismicio/types-internal
Version:
Prismic types for Custom Types and Prismic Data
16 lines (11 loc) • 466 B
text/typescript
import * as t from "io-ts"
import { NestedGroup } from "../Group"
import { NestableWidget } from "../nestable/NestableWidget"
import type { DynamicSlice, StaticSlice } from "./Slice"
export const LegacySlice = t.union([NestableWidget, NestedGroup])
export type LegacySlice = t.TypeOf<typeof LegacySlice>
export function isLegacySlice(
slice: DynamicSlice | StaticSlice,
): slice is LegacySlice {
return slice.type !== "Slice" && slice.type !== "SharedSlice"
}