Keeping aside obvious User.attribute vs Model.attribute mistake.
I did not realize that I am supposed to expose likesCount via API as well. I thought it happens auto-magically. So, this is to return this field when user info is requested from API call
use Flarum\Event\PrepareApiAttributes;
use Flarum\Api\Serializer\UserSerializer;
$events->listen(PrepareApiAttributes::class, function(PrepareApiAttributes $event) {
if ($event->isSerializer(UserSerializer::class)) {
$event->attributes['likesCount'] = $event->model->likes_count;
}
});
and only after that it shows up as user.likesCount() in javascript client.