I'm trying to add flow to some old code which has a lot of functions like this which are used with the new operator
function something() {
this.a = ""
this.b = ""
}
function main() {
const thing = new something();
return thing;
}
Let's say I want to give the main function a return type, how do I do that? I've tried typeof something and {a: string, b: string} but flow doesn't like either one and tells me
Cannot return `thing` because a call signature declaring the expected parameter / return type is missing in new object [1] but exists in function [2].Flow(prop-missing)
file.js(123, 44): [1] new object
file.js(123, 45): [2] function
I'm trying to add flow to some old code which has a lot of functions like this which are used with the new operator
Let's say I want to give the main function a return type, how do I do that? I've tried
typeof something
and{a: string, b: string}
but flow doesn't like either one and tells me