helen-dikareva/axe-testcafe

Move React type definitions to DefinitelyTyped

JoshuaKGoldberg opened this issue ยท 4 comments

It's great that you support TypeScript types! But: in a project that uses two testing libraries with global test variables declared, the declare var test: TestFn; in testcafe/ts-defs/index.d.ts will conflict with the other test library's types.

For example, in a project with both Jest and TestCafe:

package.json:

{
    "dependencies": {
        "@types/jest": "23.3.13",
        "axe-testcafe": "1.1.0",
        "jest": "24.3.0",
        "testcafe": "0.23.3"
    }
}

tsconfig.json:

{
    "compilerOptions": {
        "moduleResolution": "node"
    },
    "include": ["./src/**/*.ts"]
}

You get this lovely error in node_modules/@types/jest/index.d.ts[33:13]:

Subsequent variable declarations must have the same type.  Variable 'test' must be of type 'TestFn', but here has type 'It'.
ts(2403)

One clean solution would be to separate out the TypeScript definitions from this library into an auto-published @types/axe-testcafe on DefinitelyTyped. They'd then be installable as a separate opt-in package and benefit from the heavily automated maintenance there.

I believe this is not an issue in the latest version.
I think it's nice having the typings with the project so there is only one dependency version to maintain.

@jrparish this happens with testcafe@1.3.3.

Maybe its the testcafe typings that you're having the issue with. This project's typings don't have the test declaration - https://github.com/helen-dikareva/axe-testcafe/blob/master/index.d.ts

I think you're right, yeah - now it's just them. Thanks! ๐Ÿ™Œ