You should probably return a string:
return "link"
or
return "text"
By the way, instead of using the queryAccessRoles function, you can also use
var roles = context.getUser().getRoles();
A one-line version of your statement could then be:
return ( context.getUser().getRoles().contains( "[role1]" ) ? "link" : "text");