In React I can restrict a variable to subset of values, like
PropTypes.oneOf([\'Home\', \'About\']),
How do I do that in TypeScript?
You can combine static strings (or any regular type) by defining a union type:
type SomeType = 'Home' | 'About';
Or within an interface:
interface SomeType { prop : 'Home' | 'About'; }
And of course you can combine other types as well:
type SomeType = string | boolean;