Skip to content

Commit

Permalink
fix: accept not predicate type (#241)
Browse files Browse the repository at this point in the history
Co-authored-by: lihbr <[email protected]>
  • Loading branch information
lihbr and lihbr authored May 26, 2022
1 parent 66e01b9 commit a1812fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/predicate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ export const predicate = {

/**
* The `not` predicate checks that the path doesn't match the provided value
* exactly. It takes a single value as the argument.
* exactly. It takes a single value for a field or an array (only for tags).
*
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#not}
*/
not: pathWithArgsPredicate<[value: string | number | boolean | Date]>("not"),
not: pathWithArgsPredicate<
[value: string | number | boolean | Date | string[]]
>("not"),

/**
* The `any` predicate takes an array of values. It works exactly the same way
Expand Down
6 changes: 6 additions & 0 deletions test/predicate-not.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ test(
prismic.predicate.not("document.type", "product"),
);

test(
'[not(document.tags, ["Macaron", "Cupcake"])]',
isTitleMacro,
prismic.predicate.not("document.tags", ["Macaron", "Cupcake"]),
);

test(
"[not(my.product.price, 50)]",
isTitleMacro,
Expand Down

0 comments on commit a1812fd

Please sign in to comment.