Created
November 16, 2017 17:57
-
-
Save phpnode/53820bab3ea5354567645bfb6dbefb4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// paste me into https://codemix.github.io/flow-runtime/#/try | |
// (no gist support yet :( ) | |
import t, {reify} from 'flow-runtime'; | |
type ValidURL = string; | |
(reify: ValidURL).addConstraint(url => { | |
if (/^(.|\/)/.test(url)) { | |
return "Don't use relative URLs for some reason"; | |
} | |
}) | |
function visitURL(url: ValidURL) { | |
return url; | |
} | |
console.log(visitURL('./nope')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment