cypress-io/cypress-and-jest-typescript-example

type conflicts when running typescript build

jrr opened this issue · 0 comments

jrr commented

Using yarn run tsc to simulate a webpack build, there are currently a couple pages of type errors:

> git show --stat
commit 194918bcfc2023495fe7de090a69d24e5404e40d (HEAD -> master, origin/master, origin/HEAD)
(...)
> ./node_modules/.bin/tsc --version
Version 3.5.2
> ./node_modules/.bin/tsc
cypress/integration/spec.ts:2:3 - error TS2304: Cannot find name 'cy'.

2   cy.wrap('foo').should('equal', 'foo')
    ~~

node_modules/@types/babel__template/index.d.ts:16:28 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.

16     placeholderWhitelist?: Set<string>;
                              ~~~

node_modules/@types/mocha/index.d.ts:2680:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'beforeEach' must be of type 'Lifecycle', but here has type 'HookFunction'.

2680 declare var beforeEach: Mocha.HookFunction;
                 ~~~~~~~~~~

  node_modules/@types/jest/index.d.ts:35:13
    35 declare var beforeEach: jest.Lifecycle;
                   ~~~~~~~~~~
    'beforeEach' was also declared here.

node_modules/@types/mocha/index.d.ts:2698:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'afterEach' must be of type 'Lifecycle', but here has type 'HookFunction'.

2698 declare var afterEach: Mocha.HookFunction;
                 ~~~~~~~~~

  node_modules/@types/jest/index.d.ts:37:13
    37 declare var afterEach: jest.Lifecycle;
                   ~~~~~~~~~
    'afterEach' was also declared here.

node_modules/@types/mocha/index.d.ts:2714:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'describe' must be of type 'Describe', but here has type 'SuiteFunction'.

2714 declare var describe: Mocha.SuiteFunction;
                 ~~~~~~~~

  node_modules/@types/jest/index.d.ts:38:13
    38 declare var describe: jest.Describe;
                   ~~~~~~~~
    'describe' was also declared here.

node_modules/@types/mocha/index.d.ts:2735:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'xdescribe' must be of type 'Describe', but here has type 'PendingSuiteFunction'.

2735 declare var xdescribe: Mocha.PendingSuiteFunction;
                 ~~~~~~~~~

  node_modules/@types/jest/index.d.ts:40:13
    40 declare var xdescribe: jest.Describe;
                   ~~~~~~~~~
    'xdescribe' was also declared here.

node_modules/@types/mocha/index.d.ts:2749:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'it' must be of type 'It', but here has type 'TestFunction'.

2749 declare var it: Mocha.TestFunction;
                 ~~

  node_modules/@types/jest/index.d.ts:41:13
    41 declare var it: jest.It;
                   ~~
    'it' was also declared here.

node_modules/@types/mocha/index.d.ts:2763:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'test' must be of type 'It', but here has type 'TestFunction'.

2763 declare var test: Mocha.TestFunction;
                 ~~~~

  node_modules/@types/jest/index.d.ts:44:13
    44 declare var test: jest.It;
                   ~~~~
    'test' was also declared here.

node_modules/@types/mocha/index.d.ts:2770:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'xit' must be of type 'It', but here has type 'PendingTestFunction'.

2770 declare var xit: Mocha.PendingTestFunction;
                 ~~~

  node_modules/@types/jest/index.d.ts:43:13
    43 declare var xit: jest.It;
                   ~~~
    'xit' was also declared here.


Found 9 errors.

Most of the errors are cypress-io/cypress#6690 , but the first two look like something else.

Updating to Cypress 4.4.1 doesn't fix it. (though it has some different type errors)