{"action":"created","issue":{"url":"https://api.github.com/repos/babel/babel/issues/1299","labels_url":"https://api.github.com/repos/babel/babel/issues/1299/labels{/name}","comments_url":"https://api.github.com/repos/babel/babel/issues/1299/comments","events_url":"https://api.github.com/repos/babel/babel/issues/1299/events","html_url":"https://github.com/babel/babel/issues/1299","id":69455634,"number":1299,"title":"Flow interface declarations do not work at all","user":{"login":"thealjey","id":2216553,"avatar_url":"https://avatars.githubusercontent.com/u/2216553?v=3","gravatar_id":"","url":"https://api.github.com/users/thealjey","html_url":"https://github.com/thealjey","followers_url":"https://api.github.com/users/thealjey/followers","following_url":"https://api.github.com/users/thealjey/following{/other_user}","gists_url":"https://api.github.com/users/thealjey/gists{/gist_id}","starred_url":"https://api.github.com/users/thealjey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thealjey/subscriptions","organizations_url":"https://api.github.com/users/thealjey/orgs","repos_url":"https://api.github.com/users/thealjey/repos","events_url":"https://api.github.com/users/thealjey/events{/privacy}","received_events_url":"https://api.github.com/users/thealjey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-19T19:24:49Z","updated_at":"2015-04-19T19:58:09Z","closed_at":null,"body":"Consider the following code:\r\n\r\n    declare class ChildProcess {\r\n      on(type: string, fn: (code: number) => void): void;\r\n      kill(): void;\r\n    }\r\n    \r\n    /**\r\n     * here the nullable \"maybe\" type (the question mark) validates just fine\r\n     */\r\n    var flow: ?ChildProcess;\r\n    \r\n    function typecheck() {\r\n      /**\r\n       * everything works great up to this point\r\n       * flow is nullable, but we check for it's existence and the kill method is declared\r\n       */\r\n      if (flow) flow.kill();\r\n      /**\r\n       * and here all hell breaks loose\r\n       * - if I omit the type declaration then the next line reports that\r\n       *   the \"on\" method is undefined\r\n       * - if I leave it as is babel says that ChildProcess is undefined\r\n       * - ridiculously enough, if I put \"any\" there instead of \"ChildProcess\",\r\n       *   babel says that \"any\" is undefined (LOL, what?)\r\n       * - also, this line does not support maybe types,\r\n       *   if I put a question mark before the type babel dies with \"unexpected identifier\"\r\n       */\r\n      flow: ChildProcess = spawn('flow', [], {stdio: 'inherit'});\r\n      flow.on('close', function (code) {\r\n        \r\n      });\r\n    }\r\n\r\nThis is driving me crazy, can you please point me in the right direction if maybe I am doing something wrong here?\r\nThe reason why I think that it's a bug is that babel and flow seem to disagree about whether ChildProcess is defined or not."},"comment":{"url":"https://api.github.com/repos/babel/babel/issues/comments/94309116","html_url":"https://github.com/babel/babel/issues/1299#issuecomment-94309116","issue_url":"https://api.github.com/repos/babel/babel/issues/1299","id":94309116,"user":{"login":"thealjey","id":2216553,"avatar_url":"https://avatars.githubusercontent.com/u/2216553?v=3","gravatar_id":"","url":"https://api.github.com/users/thealjey","html_url":"https://github.com/thealjey","followers_url":"https://api.github.com/users/thealjey/followers","following_url":"https://api.github.com/users/thealjey/following{/other_user}","gists_url":"https://api.github.com/users/thealjey/gists{/gist_id}","starred_url":"https://api.github.com/users/thealjey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thealjey/subscriptions","organizations_url":"https://api.github.com/users/thealjey/orgs","repos_url":"https://api.github.com/users/thealjey/repos","events_url":"https://api.github.com/users/thealjey/events{/privacy}","received_events_url":"https://api.github.com/users/thealjey/received_events","type":"User","site_admin":false},"created_at":"2015-04-19T19:58:09Z","updated_at":"2015-04-19T19:58:09Z","body":"@sebmck then can you please explain to me why this error is happening:\r\n\r\nflow: any = _spawn.spawn('flow', [], { stdio: 'inherit' });\r\n            ^\r\nReferenceError: any is not defined\r\n    at typecheck (/Users/al/Documents/www/adcube/backend/app.js:25:12)\r\n    at Object.<anonymous> (/Users/al/Documents/www/adcube/backend/app.js:33:1)\r\n    at Module._compile (module.js:460:26)\r\n    at normalLoader (/Users/al/Documents/www/adcube/node_modules/babel/node_modules/babel-core/lib/babel/api/register/node.js:122:5)\r\n    at Object.require.extensions.(anonymous function) [as .js] (/Users/al/Documents/www/adcube/node_modules/babel/node_modules/babel-core/lib/babel/api/register/node.js:135:7)\r\n    at Module.load (module.js:355:32)\r\n    at Function.Module._load (module.js:310:12)\r\n    at Function.Module.runMain (module.js:501:10)\r\n    at Object.<anonymous> (/Users/al/Documents/www/adcube/node_modules/babel/bin/_babel-node:111:12)\r\n    at Module._compile (module.js:460:26)"}}