Does TypeScript support the ?. operator and what is its correct name?
Hello everyone! I recently started learning TypeScript and encountered a problem. Often in code I need to access a property of an object that may not exist. For example, I have a `user` object that comes from the server, and it may have a nested field `profile.name`. If I write `user.profile.name`, TypeScript throws an error that `profile` may be `undefined`. I know that JavaScript has the `?.` operator, which allows safe property access. But I'm not sure if TypeScript supports it and what its correct name is. I tried writing it like this:
```typescript
interface User {
profile?: {
name?: string;
};
}
const user: User = {};
console.log(user.profile.name); // Error: Object is possibly 'undefined'
```
If I add `?.`, the error disappears