prismicio / prismic-types

Type definitions for Prismic content, models, and APIs
https://prismic.io/docs/technologies/javascript
Apache License 2.0
11 stars 4 forks source link

prismic.predicate.not type #35

Closed SiarheiBokuts closed 2 years ago

SiarheiBokuts commented 2 years ago

Versions

Reproduction

It looks like the types for prismic.predicate.not and for some others are incorrect.

it's expected the single value

image

but in this case prismic API return error :

image

and the correct one is using array :

image
lihbr commented 2 years ago

Good catch! Looks like it's also an error within the documentation: https://prismic.io/docs/technologies/rest-api-technical-reference#not

The not predicate should work the same way as the at one, expecting a single value for all except document.tags where an array is desired.

PR is welcome to update the type on @prismicio/client: https://github.com/prismicio/prismic-client/blob/master/src/predicate.ts#L105-L111 ☺️

angeloashmore commented 2 years ago

Hey @LeoLfL, I just published @lihbr's fix (see the PR here) in @prismicio/client@v6.5.0.

Updating to the latest version should fix the TypeScript error:

npm i @prismicio/client@latest

Thanks for reporting the bug!