Files
test-repo/tests/flow/react_functional/test.js
T

13 lines
325 B
JavaScript
Raw Normal View History

2016-12-23 19:31:38 +00:00
import React from "react";
function F(props: { foo: string }) {}
<F />; // error: missing `foo`
<F foo={0} />; // error: number ~> string
<F foo="" />; // ok
// props subtyping is property-wise covariant
function G(props: { foo: string|numner }) {}
<G foo="" />; // ok
var Z = 0;
<Z />; // error, expected React component