TS2693

error TS2694: Namespace ‘React‘ has no exported member ‘NonExistent‘.

Broken Code ❌

1
2
3
import React from 'react';

export type CompositeComponent<P> = React.NonExistent<P>;

Fixed Code ✔️

When trying to import a type that is missing in an external namespace, then you have to add the missing typings yourself:

1
2
3
4
5
6
7
8
9
import React from 'react';

declare global {
namespace React {
type NonExistent<P> = React.FunctionComponent<P>;
}
}

export type CompositeComponent<P> = React.NonExistent<P>;