Skip to content

[ava-check] upgrade ava, fix broken types for flow and ts#85

Open
bcherny wants to merge 1 commit intoleebyron:masterfrom
bcherny:master
Open

[ava-check] upgrade ava, fix broken types for flow and ts#85
bcherny wants to merge 1 commit intoleebyron:masterfrom
bcherny:master

Conversation

@bcherny
Copy link

@bcherny bcherny commented Apr 29, 2018

Before, using ava-check in my project (with Ava 25) gave the following error:

node_modules/ava-check/ava-check.d.ts(5,26): error TS2305: Module '"/Users/bcherny/Sites/tsoption/node_modules/ava/types/generated"' has no exported member 'ContextualTestContext'.

And before, the ava-check build failed:

> flow check test

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ ava-check.js.flow:4:15

Cannot import ValueGenerator because there is no ValueGenerator export in testcheck.

     1│ /* @flow */
     2│
     3│ export { gen } from 'testcheck'
     4│ import type { ValueGenerator, CheckOptions } from 'testcheck'
     5│
     6│ type Test<T> = (t: T) => void;
     7│


Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ test/check.test.js:15:32

Could not decide which case to select. Since case 2 [1] may work but if it doesn't case 6 [2] looks promising too. To
fix add a type annotation to return [3].

     test/check.test.js
     12│   t.is(typeof x, 'number')
     13│ ))
     14│
 [3] 15│ test('generates with options', check({ numTests: 10 }, gen.posInt, (t, x) => {
     16│   t.true(x >= 0)
     17│ }))
     18│

     ava-check.js.flow
 [1] 13│   <T,A,B>(
     14│     genA: ValueGenerator<A>,
     15│     genB: ValueGenerator<B>,
     16│     f: (t: T, a: A, b: B) => boolean | void
     17│   ): Test<T>;
       :
 [2] 40│   <T,A>(
     41│     options: CheckOptions,
     42│     genA: ValueGenerator<A>,
     43│     f: (t: T, a: A) => boolean | void
     44│   ): Test<T>;


Warning ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ test/types.js.flow:7:3

Unused suppression comment.

      4│ import { gen, check } from '../';
      5│
      6│ test('generates', check(gen.int, gen.string, (t, x, y) => {
      7│   // $ExpectError
      8│   t.true(x * y === 321)
      9│   //         ^ string. The operand of an arithmetic operation must be a number.
     10│ }))


Found 2 errors and 1 warning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant