Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$PropertyType fails on extended class #214

Open
2 tasks done
nrabinowitz opened this issue Sep 14, 2018 · 0 comments
Open
2 tasks done

$PropertyType fails on extended class #214

nrabinowitz opened this issue Sep 14, 2018 · 0 comments

Comments

@nrabinowitz
Copy link

This is a:

  • Bug Report

Which concerns:

  • 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<C: AbstractClass> = $PropertyType<C, 'prop'>;

class ConcreteClass extends AbstractClass {
  	prop: number;
}

const i = 12;
(i: ClassProp<ConcreteClass>);

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

It also correctly errors on failures against the extended type.


Which package versions are you using?

Tried in the current Try Flow-Runtime interface, assuming this is v0.17.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant