TS2440

Import declaration conflicts with local declaration of 'React'.

Broken Code ❌

main.ts
import React from 'react';
 
declare module React {
  type MyCustomType<P> = void;
}

Fixed Code ✔️

You cannot redeclare a module that you are importing, but you can outsource your additional typings to a declaration file in order to apply declaration merging:

index.d.ts
declare namespace React {
  type MyCustomType<P> = void;
}