-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ava 0.17.0 with FlowType 0.35.0 results in type-ambiguity errors #1114
Comments
@thejameskyle halp |
@sindresorhus that kitten slays me every time. So cute! Your participation in any GitHub conversation is a welcome presence. :D |
I am getting the same error and can't seem to find a solution to it (except removing the macro possibility...) 🤔 |
I did get this working by explicitly annotating the types, something like this: /* :: import type { ContextualTest } from 'ava' */
test('my test', (t) => { t.pass('yay') } /* : ContextualTest */) But I don't want to have to do this for every single test. Another interim solution would be to tell FlowType to ignore ava. /shrug |
Just FYI: I'm having this issue with FlowType 0.36.0, too. |
Another FYI: Having the same issue with |
Fixes avajs#1114 As reported in avajs#1114, flow reports ambiguity when defining tests: ```js test('my test', t => {}) ``` Flow will report that it could apply either the `Test` type or the `Macro` type. The `Test` type is an obvious fit, but `Macro` also applies since the `...args` resolves to the empty array, and the `title?` attribute happens to be not provided. My suggested fix is to merge the `Test` and `Macro` types together since `Macro` is really a superset of the `Test` type, and we don't lose any type safety by just expecting to always get Macros. I tested this locally on a flow-typed repository and confirmed that the type ambiguity errors are solved.
Fixes avajs#1114 As reported in avajs#1114, flow reports ambiguity when defining tests: ```js test('my test', t => {}) ``` Flow will report that it could apply either the `Test` type or the `Macro` type. The `Test` type is an obvious fit, but `Macro` also applies since the `...args` resolves to the empty array, and the `title?` attribute happens to be not provided. My suggested fix is to merge the `Test` and `Macro` types together since `Macro` is really a superset of the `Test` type, and we don't lose any type safety by just expecting to always get Macros. This super set type is called `TestImplementation` which better matches how AVA names these things. I tested this locally on a flow-typed repository and confirmed that the type ambiguity errors are solved.
Oooo, nice work! Yay! <3 |
Is this released yet? I still get this problem. |
fix `Please provide additional annotation(s) to determine whether case 2 works ava` related issue: avajs/ava#1114
Description
Trying to update a project to use ava 0.17.0
For what seem like pretty standard-looking ava tests to me (as far as I know), FlowType is getting all up in my face about some ambiguity relating to the new types that ava declares. I am obviously quite scandalised by all this. Oh my!
Test Source
This is the test code in question:
Error Message & Stack Trace
When I run
flow_check
, I get 23 errors that are all very similar, like this:Config
Copy the relevant section from
package.json
:{ "ava": {} }
Command-Line Arguments
Copy your npm build scripts or the
ava
command used:Relevant Links
Environment
The text was updated successfully, but these errors were encountered: