2017-02-22 00:59:19 +03:00
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
|
2017-03-22 03:38:28 +03:00
|
|
|
exports[`test.js 1`] = `
|
2017-04-12 23:41:51 +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
|
2017-04-12 23:41:51 +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 }) {}
|
2017-04-12 23:41:51 +03:00
|
|
|
<G foo="" />; // ok
|
2016-12-23 22:31:38 +03:00
|
|
|
|
|
|
|
var Z = 0;
|
|
|
|
<Z />; // error, expected React component
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2017-04-12 23:41:51 +03:00
|
|
|
import React from "react";
|
2017-01-10 05:49:06 +03:00
|
|
|
|
2017-01-24 20:37:01 +03:00
|
|
|
function F(props: { foo: string }) {}
|
2017-02-25 02:46:20 +03:00
|
|
|
<F />; // error: missing \`foo\`
|
|
|
|
<F foo={0} />; // error: number ~> string
|
2017-04-12 23:41:51 +03:00
|
|
|
<F foo="" />; // ok
|
2017-01-31 19:27:44 +03:00
|
|
|
|
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-04-12 23:41:51 +03:00
|
|
|
<G foo="" />; // ok
|
2017-01-31 19:27:44 +03:00
|
|
|
|
2016-12-28 05:40:04 +03:00
|
|
|
var Z = 0;
|
2017-01-11 18:16:38 +03:00
|
|
|
<Z />; // error, expected React component
|
2017-04-12 23:41:51 +03:00
|
|
|
|
2016-12-23 22:31:38 +03:00
|
|
|
`;
|