* Extract custom tests from tests/flow/
Approach:
1. Remove all .js files in tests/flow except .snap.js files.
2. Copy over all .js files from tests/ in the flow repo.
3. Go through the diff looking for deletions.
- It was easy to see which deletions were due to changes in the tests
due to updates in the flow repo.
- For the rest of the deletions, I used `git blame` to verify that
they had been added by us since the flow tests were copied over.
This makes tests/flow/ simply a copy of the tests from the flow repo,
making it easier to sync with the upstream flow tests in the future.
* Add a script for syncing the flow tests
* Sync the flow tests
55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
import React from "react";
|
|
|
|
// statics = None
|
|
const A = React.createClass({ p: 0 });
|
|
(A.bar: empty); // number ~> empty (inflow below)
|
|
A.bar = 0;
|
|
|
|
// statics = Some (exact & sealed) [lit]
|
|
const B = React.createClass({
|
|
statics: { foo: 0 },
|
|
});
|
|
(B.foo: empty); // number ~> empty
|
|
(B.bar: empty); // number ~> empty (inflow below)
|
|
B.bar = 0;
|
|
|
|
// statics = Some (exact & sealed) [annot]
|
|
const C = React.createClass({
|
|
statics: ({ foo: 0 }: {| foo: number |}),
|
|
});
|
|
(C.foo: empty); // number ~> empty
|
|
(C.bar: empty); // number ~> empty (inflow below)
|
|
C.bar = 0;
|
|
|
|
// statics = Some (inexact & sealed) [annot]
|
|
const D = React.createClass({
|
|
statics: ({ foo: 0 }: { foo: number }),
|
|
});
|
|
(D.foo: empty); // number ~> empty
|
|
(D.bar: empty); // property `bar` not found
|
|
D.bar = 0; // property `bar` not found
|
|
|
|
// mixins: (exact & sealed) + (exact & sealed)
|
|
const E = React.createClass({
|
|
mixins: [{
|
|
statics: { foo: 0 },
|
|
}],
|
|
statics: { bar: 0 },
|
|
});
|
|
(E.foo: empty); // number ~> empty
|
|
(E.bar: empty); // number ~> empty
|
|
(E.baz: empty); // number ~> empty (inflow below)
|
|
E.baz = 0;
|
|
|
|
// mixins: (exact & sealed) + (inexact & sealed)
|
|
const F = React.createClass({
|
|
mixins: [{
|
|
statics: ({ foo: 0 }: { foo: number }),
|
|
}],
|
|
statics: { bar: 0 },
|
|
});
|
|
(F.foo: empty); // number ~> empty
|
|
(F.bar: empty); // number ~> empty
|
|
(F.baz: empty); // number ~> empty (inflow below)
|
|
F.baz = 0;
|