I have no idea why this doesn't check (and why the error is so big); a parsed URL should be a valid parameter to url.format
/* @flow */
import url from "url";
export function roundTripUrl(urlStr: string): string {
return url.format(url.parse(urlStr));
}
/Users/daniel.heath/Projects/ask-izzy/flowtest/foo.js:6:18,32: call of method parse
Error:
/private/tmp/flow/flowlib_1030271d/node.js:837:16,21: null
This type is incompatible with
/private/tmp/flow/flowlib_1030271d/node.js:852:16,21: string
/Users/daniel.heath/Projects/ask-izzy/flowtest/foo.js:6:18,32: call of method parse
Error:
/private/tmp/flow/flowlib_1030271d/node.js:838:15,21: null
This type is incompatible with
/private/tmp/flow/flowlib_1030271d/node.js:853:15,21: boolean
/Users/daniel.heath/Projects/ask-izzy/flowtest/foo.js:6:18,32: call of method parse
Error:
/private/tmp/flow/flowlib_1030271d/node.js:839:12,17: null
This type is incompatible with
/private/tmp/flow/flowlib_1030271d/node.js:854:12,17: string
/Users/daniel.heath/Projects/ask-izzy/flowtest/foo.js:6:18,32: call of method parse
Error:
/private/tmp/flow/flowlib_1030271d/node.js:840:12,17: null
This type is incompatible with
/private/tmp/flow/flowlib_1030271d/node.js:857:12,17: string
/Users/daniel.heath/Projects/ask-izzy/flowtest/foo.js:6:18,32: call of method parse
Error:
/private/tmp/flow/flowlib_1030271d/node.js:841:12,17: null
This type is incompatible with
/private/tmp/flow/flowlib_1030271d/node.js:856:12,26: union type
/Users/daniel.heath/Projects/ask-izzy/flowtest/foo.js:6:18,32: call of method parse
Error:
/private/tmp/flow/flowlib_1030271d/node.js:842:16,21: null
This type is incompatible with
/private/tmp/flow/flowlib_1030271d/node.js:855:16,21: string
/Users/daniel.heath/Projects/ask-izzy/flowtest/foo.js:6:18,32: call of method parse
Error:
/private/tmp/flow/flowlib_1030271d/node.js:843:12,17: null
This type is incompatible with
/private/tmp/flow/flowlib_1030271d/node.js:861:12,17: string
/Users/daniel.heath/Projects/ask-izzy/flowtest/foo.js:6:18,32: call of method parse
Error:
/private/tmp/flow/flowlib_1030271d/node.js:844:14,19: null
This type is incompatible with
/private/tmp/flow/flowlib_1030271d/node.js:859:14,19: string
/Users/daniel.heath/Projects/ask-izzy/flowtest/foo.js:6:18,32: call of method parse
Error:
/private/tmp/flow/flowlib_1030271d/node.js:845:13,15: null
This type is incompatible with
/private/tmp/flow/flowlib_1030271d/node.js:860:13,18: object type
/Users/daniel.heath/Projects/ask-izzy/flowtest/foo.js:6:18,32: call of method parse
Error:
/private/tmp/flow/flowlib_1030271d/node.js:846:16,21: null
This type is incompatible with
/private/tmp/flow/flowlib_1030271d/node.js:858:16,21: string
/Users/daniel.heath/Projects/ask-izzy/flowtest/foo.js:6:18,32: call of method parse
Error:
/private/tmp/flow/flowlib_1030271d/node.js:851:12,17: undefined
This type is incompatible with
/private/tmp/flow/flowlib_1030271d/node.js:848:11,16: string
/Users/daniel.heath/Projects/ask-izzy/flowtest/foo.js:6:18,32: call of method parse
Error:
/private/tmp/flow/flowlib_1030271d/node.js:856:21,26: number
This type is incompatible with
/private/tmp/flow/flowlib_1030271d/node.js:841:12,17: string
Found 12 errors
Using flow 0.16
I have no idea why this doesn't check (and why the error is so big); a parsed URL should be a valid parameter to
url.formatSample program:
Output: