This PR introduces a new ESLint rule: strongly-typed-inject-component. The new rule ensures that functional components that are injected with the injectComponent HOC, are strongly typed.
Incorrect
Correct
```ts
import {injectComponent} from 'react-obsidian';
type Own = {
name: string;
};
type Injected = {
bar: Bar;
};
const _Foo = (props: Own & Injected) => {
return null;
};
export const Foo = injectComponent(_Foo, SomeGraph);
```
```ts
import {injectComponent} from 'react-obsidian';
type Own = {
name: string;
};
type Injected = {
bar: Bar;
};
const _Foo = (props: Own & Injected) => {
return null;
};
// The rule enforces the correct types are passed to the injectComponent HOC
export const Foo = injectComponent(_Foo, SomeGraph);
```
This PR introduces a new ESLint rule:
strongly-typed-inject-component
. The new rule ensures that functional components that are injected with theinjectComponent
HOC, are strongly typed.