96 lines
3.1 KiB
Plaintext
96 lines
3.1 KiB
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`main.js 1`] = `
|
|
====================================options=====================================
|
|
parsers: ["flow"]
|
|
printWidth: 80
|
|
| printWidth
|
|
=====================================input======================================
|
|
// @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}>
|
|
|
|
=====================================output=====================================
|
|
// @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 1`] = `
|
|
====================================options=====================================
|
|
parsers: ["flow"]
|
|
printWidth: 80
|
|
| printWidth
|
|
=====================================input======================================
|
|
/* @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
|
|
|
|
=====================================output=====================================
|
|
/* @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
|
|
|
|
================================================================================
|
|
`;
|