I'm just working with TypeScript for a few weeks, but I find it very interesting!
Are interfaces that are applied to an object also input validators? For example if I have a contact form or an API endpoint and I declare the type it produces - e. g.:
interface ContactFormData {
firstName: string,
lastName: string,
shoeSize: number,
favoriteBooks: Book[]
}
I know it only ensures the types of properties and can't protect against XSS.
Is it also possible to pass standard values with interfaces, assuming a property of an object which can also be "undefined" is empty?