You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had an issue while generating types for Custom Types with id items. You can see the logs below.
TypeError: Cannot read properties of undefined (reading 'model')
at file:///Users/alban/[...]/node_modules/.pnpm/[email protected]_zdskoi4kizcgcz3c254mxvxata/node_modules/prismic-ts-codegen/dist/lib/getAPIIDPath.js:11:52
The logs were not very clear and I had to dig into the package to find that items fits a conditions that triggers the errors.
The code that triggers the error is located at prismic-ts-codegen/dist/lib/getAPIIDPath.js and specifically this condition :
if (element.id === "items") {
const previousElement = config.path[i - 1];
if (isCustomTypeModelSlice(previousElement.model) || isSharedSliceModel(previousElement.model)) {
return `${element.id}[]`;
}
}
Describe the solution you'd like
This could be avoided in the future by providing a list of forbidden Custom Types IDs, or even better, blocking the creation of Custom Types with forbidden IDs in the first place :)
The text was updated successfully, but these errors were encountered:
Problem:
I had an issue while generating types for Custom Types with id
items
. You can see the logs below.The logs were not very clear and I had to dig into the package to find that
items
fits a conditions that triggers the errors.The code that triggers the error is located at
prismic-ts-codegen/dist/lib/getAPIIDPath.js
and specifically this condition :Describe the solution you'd like
This could be avoided in the future by providing a list of forbidden Custom Types IDs, or even better, blocking the creation of Custom Types with forbidden IDs in the first place :)
The text was updated successfully, but these errors were encountered: