I see that this issue is being addressed via changes to Drupal core.
However in the meantime, I was hoping for a workaround for use with Drupal 10. I created the test module shown at the top of this issue and the computed field became available in my Views. However, at the point of trying to add it to a View, I got the following error:
Error: Call to a member function getType() on null in Drupal\views\Plugin\views\field\EntityField->defineOptions() (line 375 of /var/www/html/web/core/modules/views/src/Plugin/views/field/EntityField.php).
Is this expected, or have I missed something? Do I have to wait until the changes above have been merged to Drupal core before I can use computed fields in Views?
Thanks @gisle !
mike-kelly β created an issue.