$PropertyType fails on extended class
- Dominant language
- JavaScript
- Stars
- 797
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Description
This is a:
- [x] Bug Report
Which concerns:
- [x] flow-runtime
---
### What is the current behaviour?
I am trying to use `$PropertyType` to check the property of an extended class. The following code illustrates the issue:
```
class AbstractClass {
prop: any;
};
type ClassProp = $PropertyType;
class ConcreteClass extends AbstractClass {
prop: number;
}
const i = 12;
(i: ClassProp);
```
Running this example in the Try Flow-Runtime interface throws the following error: `Can only intersect object types`.
---
### What is the expected behaviour?
Parity with Flow: The same code [runs without errors in Flow](https://flow.org/try/#0MYGwhgzhAECCBGEAuAnMwkGFxWgbwChpoBIABxQHsyAuaMAOwE8BuAgXzYKSbIFNo2SBAAKVMgB5sALzoJkaDEKgA+aAF5oAEjHU+KHgBVefKSGkAaaAHIK1ayq6hhgyg2Ao+SPsph8AHt4MACYw8qjoWDgwhMTk4nQMAK4AtvD6bOwEBMBuyNAAlhrQAIwATGwAFAV0vrqSmG4eXj7RKgCULEA)
It also [correctly errors on failures against the extended type](https://flow.org/try/#0MYGwhgzhAECCBGEAuAnMwkGFxWgbwChpoBIABxQHsyAuaMAOwE8BuAgXzYKSbIFNo2SBAAKVMgB5sALzoJkaDEKgA+aAF5oAEjHU+KHgBVefKSGkAaaAHIK1ayq6hhgyg2Ao+SPsph8AHt4MACYw8qjoWDgwhMTk4nQMAK4AtvD6bOwEBMBuyNAAlho2AGaUlNZsABQFdL66kphuHl4+0SoAlCxAA).
---
### Which package versions are you using?
Tried in the current Try Flow-Runtime interface, assuming this is `v0.17.0`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.