Example 1.
Non-nullable someStaticProperty
, this will throw a lint error
import { NamedExoticComponent, memo } from "react";
type WithComponentId = { componentId: string };
type ScreenComponentStaticMembers = {
someStaticProperty: string;
};
type AliasedType<P = {}> = NamedExoticComponent<P & WithComponentId> &
ScreenComponentStaticMembers;
type MyComponentProps = {
greeting: string;
};
const MyComponent: AliasedType<MyComponentProps> = memo(({ greeting }) => (
<span>{greeting} there!</span>
));
MyComponent.someStaticProperty = "baz";
Example 2.
Optional someStaticProperty
, this will work.
import { NamedExoticComponent, memo } from "react";
type WithComponentId = { componentId: string };
type ScreenComponentStaticMembers = {
someStaticProperty?: string;
};
type AliasedType<P = {}> = NamedExoticComponent<P & WithComponentId> &
ScreenComponentStaticMembers;
type MyComponentProps = {
greeting: string;
};
const MyComponent: AliasedType<MyComponentProps> = memo(({ greeting }) => (
<span>{greeting} there!</span>
));
MyComponent.someStaticProperty = "baz";