Filter out nodes based on list

What I want to do

I’m working on a social media app, and my Dgraph schema has Feed and Post types that look like this (simplified):

type Feed {

type Post {

feedPostTypes: [string] .
postType: string .

The postType predicate can be one of "TEXT", "PHOTO", or "VIDEO", indicating the type of content contained in the post.

The feedPostTypes predicate contains a list of the post types that are enabled in the feed. For example, if feedPostTypes is ["PHOTO", "VIDEO"], then the user doesn’t want to see posts containing only text.

My question is: When I’m querying for posts to show in the feed, how can I filter out posts whose type doesn’t match the types enabled in the feed?

What I did

I’m using DQL, so I tried multiple query blocks and a variable, but this doesn’t work:

  var(func: uid("0x1")) {
    types as feedPostTypes

  posts(func: type(Post)) @filter(anyofterms(postType, val(types)) {

Why anyofterms? have you tried eq? can you share a simple sample?

I have tried both anyofterms and eq, but they only work when feedPostTypes has one value, such as ["TEXT"]. When feedPostTypes has multiple values, such as ["PHOTO", "VIDEO"], I get this error:

Value variables not supported for predicate with list type.

It’s just really strange that it behaves differently depending on how many items are in the feedPostTypes list.