-
Notifications
You must be signed in to change notification settings - Fork 0
Flow TestInterface does not accept exact context type #2
Comments
There is something even more wrong with this: // @flow
import untypedTest from 'ava';
import type {
TestInterface
} from 'ava';
type ContextType = {
server: ServerType
};
const test: TestInterface<ContextType> = untypedTest;
|
Which Flow version is this? I'm pretty sure this worked when I wrote the definition, but I don't use Flow so I may have overlooked this. Fixes to the definition are most welcome. Would be good to have a type-check regression test for this too. |
I was able to work around this error by casting to import untypedTest from 'ava'
const test: TestInterface<{ directory: string }> = (untypedTest: any) I'm using Flow v0.77.0 and played around for a while with the type definition, but haven't yet been able to find a fix. |
Thanks for your comment @vinsonchuong. It prompted me to double-check our Flow recipe, and your solution is what's documented there: https://github.com/avajs/ava/blob/master/docs/recipes/flow.md#typing-tcontext I'd still love if this wasn't necessary, of course. |
@vinsonchuong Is there a more recent solution to this? |
Things are working as expected and an error is thrown because I believe an alternative would be to set
|
Description
Flow TestInterface does not accept exact context type.
Test Source
Error Message & Stack Trace
Environment
Tell us which operating system you are using, as well as which versions of Node.js, npm, and AVA. Run the following to get it quickly:
The text was updated successfully, but these errors were encountered: