The code in the examples needs to be checked more carefully.
In the first example, you create the schema with a 'status' property, then try to create entries with a 'name' property instead. In the second one, the TypeScript example, you create an enum called 'Status', then refer to it as 'Rating' in a property called 'rating' to create the schema. Then you try to create entries with a 'name' property again. So, nothing really makes much sense at all in the code.
What's worse is that in the TypeScript example you use the enum as if it was simply interchangeable with a string. That is, you use the string 'Valid' instead of using Status.Valid. TypeScript *will* refuse that as an error.