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
import{predicate}from'@prismicio/client'predicate.at('my.blog_post.is_hidden',true)// TypeScript complains that predicate.at() doesn't accept a boolean value in the second argument
Steps to reproduce
Run the above code snippet.
What is expected?
Predicates accept boolean values.
What is actually happening?
The code runs correctly (i.e. it handles booleans in the final API URL), but TypeScript says it is invalid.
The text was updated successfully, but these errors were encountered:
Predicates are typed to only accept
string
s andnumber
s (and arrays of those) by default.If a predicate refers to a Boolean field, however, a
boolean
value is needed.See this Prismic Community thread for more details: https://community.prismic.io/t/typescript-error-when-using-booleans-in-predicates/9391
Versions
Reproduction
Steps to reproduce
Run the above code snippet.
What is expected?
Predicates accept boolean values.
What is actually happening?
The code runs correctly (i.e. it handles
booleans
in the final API URL), but TypeScript says it is invalid.The text was updated successfully, but these errors were encountered: