throw TypeError when yield is used wrong