Add typespec syntax for records

Closes #2389.