SolvedDefinitelyTyped @types/react breaks with 2.4.1

  • [ X] I tried using the @types/react package with typescript 2.4.1 and it does not build
  • [ X] I tried using the latest stable version of tsc.
    [at-loader] Checking finished with 1 errors Error in bail mode: [at-loader] node_modules/@types/react/index.d.ts:181:11 Type 'Component<P, S>' has no properties in common with type 'ComponentLifecycle<P, S>'.
12 Answers

✔️Accepted Answer

To fix this, I ended up locally forking the version of React type definitions I use and making the following change.

+interface Component<P = {}, S = {}> extends ComponentLifecycle<P, S> { }
-class Component<P, S> extends ComponentLifecycle<P, S> {
+class Component<P, S> {

This change reflects the current state of the React type definitions.

The proper fix is likely to upgrade your React type definitions and possibly any React dependencies used in your project.

Other Answers:

Only typescript 2.3.4 is working . I have tried, 2.2.2 / 2.4/ 2.5.2 - none worked.

I rolled back to typescript 2.3.2 and was able to move past this.

Changing to 2.3.2 worked for compiling with tsc but not with gulp-typescript. For now I just edited index.d.ts for the conflicting types to have a property in common, but there must be another workaround.

More Issues: