82 lines
2.4 KiB
Plaintext
82 lines
2.4 KiB
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`main.js - flow-verify 1`] = `
|
|
// @flow
|
|
|
|
var React = require('react');
|
|
|
|
class CustomComponent extends React.Component {
|
|
props: {
|
|
prop: string
|
|
};
|
|
}
|
|
|
|
var a: React.Element<{prop: string}> = <CustomComponent prop="asdf" />;
|
|
var b: React.Element<{prop1: string}> = <CustomComponent prop="asdf" />; // Error: Props<{prop}> ~> Props<{prop1}>
|
|
|
|
<div id="asdf" />;
|
|
<div id={42} />; // Error: (\`id\` prop) number ~> string
|
|
var c: React.Element<{id: string}> = <div id="asdf" />;
|
|
var d: React.Element<{id: number}> = <div id="asdf" />; // Error: Props<{id:string}> ~> Props<{id:number}>
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// @flow
|
|
|
|
var React = require("react");
|
|
|
|
class CustomComponent extends React.Component {
|
|
props: {
|
|
prop: string
|
|
};
|
|
}
|
|
|
|
var a: React.Element<{ prop: string }> = <CustomComponent prop="asdf" />;
|
|
var b: React.Element<{ prop1: string }> = <CustomComponent prop="asdf" />; // Error: Props<{prop}> ~> Props<{prop1}>
|
|
|
|
<div id="asdf" />;
|
|
<div id={42} />; // Error: (\`id\` prop) number ~> string
|
|
var c: React.Element<{ id: string }> = <div id="asdf" />;
|
|
var d: React.Element<{ id: number }> = <div id="asdf" />; // Error: Props<{id:string}> ~> Props<{id:number}>
|
|
|
|
`;
|
|
|
|
exports[`strings.js - flow-verify 1`] = `
|
|
/* @flow */
|
|
|
|
var React = require('react');
|
|
|
|
var Div = 'div';
|
|
var Bad = 'bad';
|
|
var Str: string = 'str';
|
|
|
|
<Div />; // This is fine
|
|
<Bad />; // Error: 'bad' not in JSXIntrinsics
|
|
<Str />; // Error: string ~> keys of JSXIntrinsics
|
|
|
|
React.createElement('div', {}); // This is fine
|
|
React.createElement('bad', {}); // Error: 'bad' not in JSXIntrinsics
|
|
React.createElement(Str, {}); // Error: string ~> keys of JSXIntrinsics
|
|
|
|
// TODO: Make this an error
|
|
<Div id={42} />; // Not an error but should be eventually
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
/* @flow */
|
|
|
|
var React = require("react");
|
|
|
|
var Div = "div";
|
|
var Bad = "bad";
|
|
var Str: string = "str";
|
|
|
|
<Div />; // This is fine
|
|
<Bad />; // Error: 'bad' not in JSXIntrinsics
|
|
<Str />; // Error: string ~> keys of JSXIntrinsics
|
|
|
|
React.createElement("div", {}); // This is fine
|
|
React.createElement("bad", {}); // Error: 'bad' not in JSXIntrinsics
|
|
React.createElement(Str, {}); // Error: string ~> keys of JSXIntrinsics
|
|
|
|
// TODO: Make this an error
|
|
<Div id={42} />; // Not an error but should be eventually
|
|
|
|
`;
|