dequelabs / react-axe

[DEPRECATED] Accessibility auditing for React.js applications
Other
1.16k stars 45 forks source link

3.5.0 fails to build #151

Closed gombosg closed 4 years ago

gombosg commented 4 years ago

Update fails to build:

TypeScript error in /home/.../node_modules/react-axe/after.ts(4,32):
Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Component<{}, {}, any>'.
  No index signature with a parameter of type 'string' was found on type 'Component<{}, {}, any>'.  TS7053

    2 | 
    3 | function after(host: React.Component, name: string, cb: Function): void {
  > 4 |   const originalFn: Function = host[name];
      |                                ^
    5 |   let restoreFn: () => void;
    6 | 
    7 |   if (originalFn) {

Project uses TS 3.9.5. tsconfig:

{
  "compilerOptions": {
    "target": "es5",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react"
  },
  "include": ["src", "typings"]
}

Let me know if you need additional information!

straker commented 4 years ago

I'm not able to reproduce that error using the config you provided and this code:

import reactAxe from 'react-axe';
import React from 'react';
import ReactDOM from 'react-dom';

reactAxe(React, ReactDOM, 1000, {}, {});

Can you show me what your code looks like that triggers that error?

gombosg commented 4 years ago

Thanks for the reply!

OK, updated, to 3.5.2 in the meantime from 3.5.0. Now it's a different error:

Expected 5 arguments, but got 3.  TS2554

    27 |     import("react-axe")
    28 |       .then(module => module.default)
  > 29 |       .then(axe => axe(React, ReactDOM, 1000));
       |                    ^
    30 |   }
    31 | }
    32 | 

After adding {}, {} to the axe arguments, it builds. But, still:

I think it's a bug... but as I look at master it'll be fixed in the next release anyway. :slightly_smiling_face:

straker commented 4 years ago

Yep, we have a fix in place thanks to another user and will release a 3.5.3 soon. Sorry for all the problems everyone.

gombosg commented 4 years ago

Thanks!... absolutely no problem, it's OSS, thanks for developing. 🙂