Union types are not applied on properties
Open
bug
regression
Typing: unions/intersections
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
I expect properties to inherit union types
```typescript
type Student = {
type: 'student'
}
type Teacher = {
type: 'teacher'
}
const getType = (someone : Student | Teacher) => someone.type;
const type = getType({ type: 'student' });
('student' : typeof type);
// ^ string literal `teacher` [1] is incompatible with string literal `student` [2].
```
Contributor guide
Assessment
This issue has not been assessed yet.