Avatar ·

Default values for TypeScript interfaces: how to set?

Hello everyone! I recently started learning TypeScript and ran into a problem. I have an interface for application configuration: ```typescript interface UserConfig { name: string; age: number; isActive: boolean; email?: string; } ``` When I create an object, I have to explicitly specify all fields, even those I want to make optional. For example: ```typescript const config: UserConfig = { name: "Ivan", age: 25, isActive: true // email not specified }; ``` But I need the `isActive` field to default to `true` and `email` to default to `""` (empty string) if they are not specified. How can I do this? Is it possible to set default values directly in the interface? Or do I need to use classes? I tried writing like this: ```typescript interface UserConfig