2016-12-23 22:31:38 +03:00
|
|
|
exports[`test test.js 1`] = `
|
2016-12-30 19:56:42 +03:00
|
|
|
"import React from \"react\";
|
2016-12-23 22:31:38 +03:00
|
|
|
|
|
|
|
function F(props: { foo: string }) {}
|
|
|
|
<F />; // error: missing \`foo\`
|
|
|
|
<F foo={0} />; // error: number ~> string
|
2016-12-30 19:56:42 +03:00
|
|
|
<F foo=\"\" />; // ok
|
2016-12-23 22:31:38 +03:00
|
|
|
|
|
|
|
// props subtyping is property-wise covariant
|
|
|
|
function G(props: { foo: string|numner }) {}
|
2016-12-30 19:56:42 +03:00
|
|
|
<G foo=\"\" />; // ok
|
2016-12-23 22:31:38 +03:00
|
|
|
|
|
|
|
var Z = 0;
|
|
|
|
<Z />; // error, expected React component
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2017-01-10 05:49:06 +03:00
|
|
|
import React from \"react\";
|
|
|
|
|
2017-01-24 20:37:01 +03:00
|
|
|
function F(props: { foo: string }) {}
|
2017-01-26 22:57:43 +03:00
|
|
|
<F />; /* error: missing \`foo\`*/
|
|
|
|
<F foo={0} />; /* error: number ~> string*/
|
|
|
|
<F foo=\"\" />; // ok
|
2016-12-27 21:29:31 +03:00
|
|
|
// props subtyping is property-wise covariant
|
2017-01-24 20:37:01 +03:00
|
|
|
function G(props: { foo: string | numner }) {}
|
2017-01-26 22:57:43 +03:00
|
|
|
<G foo=\"\" />; // ok
|
2016-12-28 05:40:04 +03:00
|
|
|
var Z = 0;
|
2017-01-11 18:16:38 +03:00
|
|
|
<Z />; // error, expected React component
|
|
|
|
"
|
2016-12-23 22:31:38 +03:00
|
|
|
`;
|