diff --git a/packages/gatsby-source-prismic/src/runtime/typePaths.ts b/packages/gatsby-source-prismic/src/runtime/typePaths.ts index 9ec6cc59..5e10a4e1 100644 --- a/packages/gatsby-source-prismic/src/runtime/typePaths.ts +++ b/packages/gatsby-source-prismic/src/runtime/typePaths.ts @@ -50,7 +50,7 @@ const fieldToTypePaths = < } case prismicT.CustomTypeModelSliceType.Slice: { - const primary = Object.entries(model["non-repeat"]).flatMap( + const primary = Object.entries(model["non-repeat"] || {}).flatMap( ([fieldId, fieldModel]) => fieldToTypePaths( [...path, "primary", transformFieldName(fieldId)], @@ -59,7 +59,7 @@ const fieldToTypePaths = < ), ); - const items = Object.entries(model.repeat).flatMap( + const items = Object.entries(model.repeat || {}).flatMap( ([fieldId, fieldModel]) => fieldToTypePaths( [...path, "items", transformFieldName(fieldId)],