import type Foo from 'foo';
function log(foo: Foo) {
console.log(foo);
}
Complains that Foo is "defined but never used" (no-unused-vars).
PR #89 was previously submitted but withdrawn to address this, but the problem's still there. Filing this issue to make sure we don't lose track of it.
Ok thanks!. So I think I know how to fix this - do the same escope patching as for decorators.
However there's some more places where flow types are used that could result in the same error right? We probably want to cover all of those as well?
function log(foo): Foo { return 1; } // return
var foo: Foo = 1; // var decl
I'l probably need to use the tests in https://github.com/babel/babel/blob/088846a3479375a51d71084cb4fd70ef8fa21d29/test/acorn/tests-flow.js then? Looks like a lot of places!
@wincent I think #109 should fix a lot of the flow type unused issues? There's a lot missing but it probably covers most use cases.
Thanks @hzoo!
Still got this error :pill:
import type { TDemo } from '../typings/demo';
鈹溾攢 [email protected]
鈹斺攢 [email protected]
鈹斺攢 [email protected]
I also had the same problem with version 8.2.1:
import type { $Application, $Request, $Response } from 'express'
The only thing that helped was rollback to version 7.2.1.
Same issue here. 8.0.3 is fine
import type {Request, Response} from '../types'
flow react warning type 'Props' is defined but never used no-unused-vars how handle?
Most helpful comment
Same issue here. 8.0.3 is fine