Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* @flow */

export const input = `
function testFunction() : string {
const value = "hello";
}
`;

export const expected = `
import t from "flow-runtime";

function testFunction() {
const _returnType = t.return(t.string());

const value = "hello";
return _returnType.assert();
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ export default function transformVisitors (context: ConversionContext): Object {
if (body.node.body
// do not add if last statement is return one
&& (body.node.body.length === 0
|| !body.node.body[ body.node.body.length - 1].type === "ReturnStatement")
|| body.node.body[body.node.body.length - 1].type !== 'ReturnStatement')
) {
// we do not add arguments here
// only "return;"
Expand Down