Text casting to string, with assertion for null/undefined