Skip to content

Commit

Permalink
Add Flow render type syntax test
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalduez committed Aug 14, 2024
1 parent 42e7ba8 commit a3c96fc
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions test/__file_snapshots__/hermes-cjsm---Flow-render-types-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use strict";

var _jsxRuntime = require("react/jsx-runtime");
function Foo() {
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
}
function Bar() {
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Foo, {});
}
function Baz({
foo
}) {
/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
children: foo
});
}
14 changes: 14 additions & 0 deletions test/__file_snapshots__/hermes-esm---Flow-render-types-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { jsx as _jsx } from "react/jsx-runtime";
function Foo() {
return /*#__PURE__*/_jsx("div", {});
}
function Bar() {
return /*#__PURE__*/_jsx(Foo, {});
}
function Baz({
foo
}) {
/*#__PURE__*/_jsx("div", {
children: foo
});
}
16 changes: 16 additions & 0 deletions test/__file_snapshots__/hermes-node---Flow-render-types-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use strict";

var _jsxRuntime = require("react/jsx-runtime");
function Foo() {
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
}
function Bar() {
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Foo, {});
}
function Baz({
foo
}) {
/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
children: foo
});
}
8 changes: 8 additions & 0 deletions test/fixtures/flow-syntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@ module.exports = [
type MappedType = {[key in Union]: number}
`,
],
[
'Flow render types',
`
component Foo() { return <div /> }
component Bar() renders Foo { return <Foo /> }
component Baz(foo: renders Foo) { <div>{foo}</div> }
`,
],
];

0 comments on commit a3c96fc

Please sign in to comment.