import { AdminPagesContext } from '../../../types/admin';
export default function withAdminPagesOutletContext(
- WrappedComponent: React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<AdminPagesContext>>
- >,
+ WrappedComponent: React.ComponentType<React.PropsWithChildren<AdminPagesContext>>,
) {
return function WithAdminPagesOutletContext() {
const { adminPages } = useOutletContext<AdminPagesContext>();
}
export default function withAppStateContext<P>(
- WrappedComponent: React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<P & WithAppStateContextProps>>
- >,
+ WrappedComponent: React.ComponentType<React.PropsWithChildren<P & WithAppStateContextProps>>,
) {
return class WithAppStateContext extends React.PureComponent<
Omit<P, keyof WithAppStateContextProps>
}
export default function withAvailableFeatures<P>(
- WrappedComponent: React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<P & WithAvailableFeaturesProps>>
- >,
+ WrappedComponent: React.ComponentType<React.PropsWithChildren<P & WithAvailableFeaturesProps>>,
) {
return class WithAvailableFeatures extends React.PureComponent<
Omit<P, keyof WithAvailableFeaturesProps>
import { ComponentContext } from './ComponentContext';
export default function withComponentContext<P extends Partial<ComponentContextShape>>(
- WrappedComponent: React.ComponentType<React.PropsWithChildren<React.PropsWithChildren<P>>>,
+ WrappedComponent: React.ComponentType<React.PropsWithChildren<P>>,
) {
return class WithComponentContext extends React.PureComponent<
Omit<P, keyof ComponentContextShape>
}
export default function withLanguagesContext<P>(
- WrappedComponent: React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<P & WithLanguagesContextProps>>
- >,
+ WrappedComponent: React.ComponentType<React.PropsWithChildren<P & WithLanguagesContextProps>>,
) {
return class WithLanguagesContext extends React.PureComponent<
Omit<P, keyof WithLanguagesContextProps>
}
export default function withMetricsContext<P>(
- WrappedComponent: React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<P & WithMetricsContextProps>>
- >,
+ WrappedComponent: React.ComponentType<React.PropsWithChildren<P & WithMetricsContextProps>>,
) {
return class WithMetricsContext extends React.PureComponent<
Omit<P, keyof WithMetricsContextProps>
}
export function withQualityProfilesContext<P extends Partial<QualityProfilesContextProps>>(
- WrappedComponent: React.ComponentType<React.PropsWithChildren<React.PropsWithChildren<P>>>,
-): React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<Omit<P, keyof QualityProfilesContextProps>>>
-> {
+ WrappedComponent: React.ComponentType<React.PropsWithChildren<P>>,
+): React.ComponentType<React.PropsWithChildren<Omit<P, keyof QualityProfilesContextProps>>> {
function ComponentWithQualityProfilesProps(props: P) {
const context = useOutletContext<QualityProfilesContextProps>();
return <WrappedComponent {...props} {...context} />;
}
- (
- ComponentWithQualityProfilesProps as React.FC<
- React.PropsWithChildren<React.PropsWithChildren<P>>
- >
- ).displayName = getWrappedDisplayName(WrappedComponent, 'withQualityProfilesContext');
+ (ComponentWithQualityProfilesProps as React.FC<React.PropsWithChildren<P>>).displayName =
+ getWrappedDisplayName(WrappedComponent, 'withQualityProfilesContext');
return ComponentWithQualityProfilesProps;
}
const { definition } = setting;
const name = getUniqueName(definition);
- let Input: React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<DefaultSpecializedInputProps>>
- > = PrimitiveInput;
+ let Input: React.ComponentType<React.PropsWithChildren<DefaultSpecializedInputProps>> =
+ PrimitiveInput;
if (isCategoryDefinition(definition) && definition.multiValues) {
Input = MultiValueInput;
}
interface Props extends DefaultInputProps {
- input: React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<DefaultSpecializedInputProps>>
- >;
+ input: React.ComponentType<React.PropsWithChildren<DefaultSpecializedInputProps>>;
}
export default class InputForSecured extends React.PureComponent<Props, State> {
function withOptions(
options: string[],
-): React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<DefaultSpecializedInputProps>>
-> {
+): React.ComponentType<React.PropsWithChildren<DefaultSpecializedInputProps>> {
return function Wrapped(props: DefaultSpecializedInputProps) {
return <InputForSingleSelectList options={options} {...props} />;
};
const { definition } = setting;
const typeMapping: {
[type in SettingType]?: React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<DefaultSpecializedInputProps>>
+ React.PropsWithChildren<DefaultSpecializedInputProps>
>;
} = {
STRING: InputForString,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
export function getWrappedDisplayName<P>(
- WrappedComponent: React.ComponentType<React.PropsWithChildren<React.PropsWithChildren<P>>>,
+ WrappedComponent: React.ComponentType<React.PropsWithChildren<P>>,
hocName: string,
) {
const wrappedDisplayName = WrappedComponent.displayName ?? WrappedComponent.name ?? 'Component';
import { CurrentUser, isLoggedIn } from '../../types/users';
import { getWrappedDisplayName } from './utils';
-export function whenLoggedIn<P>(
- WrappedComponent: React.ComponentType<React.PropsWithChildren<React.PropsWithChildren<P>>>,
-) {
+export function whenLoggedIn<P>(WrappedComponent: React.ComponentType<React.PropsWithChildren<P>>) {
class Wrapper extends React.Component<P & { currentUser: CurrentUser }> {
static displayName = getWrappedDisplayName(WrappedComponent, 'whenLoggedIn');
export function withCLanguageFeature<P>(
WrappedComponent: React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<P & { hasCLanguageFeature: boolean }>>
+ React.PropsWithChildren<P & { hasCLanguageFeature: boolean }>
>,
) {
class Wrapper extends React.Component<Omit<P, 'hasCLanguageFeature'>> {
}
export default function withIndexationContext<P>(
- WrappedComponent: React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<P & WithIndexationContextProps>>
- >,
+ WrappedComponent: React.ComponentType<React.PropsWithChildren<P & WithIndexationContextProps>>,
) {
return class WithIndexationContext extends React.PureComponent<
Omit<P, keyof WithIndexationContextProps>
Component,
showIndexationMessage,
}: {
- Component: React.ComponentType<React.PropsWithChildren<React.PropsWithChildren<P>>>;
+ Component: React.ComponentType<React.PropsWithChildren<P>>;
showIndexationMessage: (props: P) => boolean;
}) {
return function WithIndexationGuard(props: React.PropsWithChildren<P>) {
export default function withKeyboardNavigation<P>(
WrappedComponent: React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<P & Partial<WithKeyboardNavigationProps>>>
+ React.PropsWithChildren<P & Partial<WithKeyboardNavigationProps>>
>,
) {
return class Wrapper extends React.Component<P & WithKeyboardNavigationProps> {
import { Location, useLocation } from 'react-router-dom';
export default function withLocation<P>(
- WrappedComponent: React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<P & { location: Location }>>
- >,
+ WrappedComponent: React.ComponentType<React.PropsWithChildren<P & { location: Location }>>,
) {
return function WithLocation(props: Omit<P, 'location'>) {
const location = useLocation();
}
export function withNotifications<P>(
- WrappedComponent: React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<P & WithNotificationsProps>>
- >,
+ WrappedComponent: React.ComponentType<React.PropsWithChildren<P & WithNotificationsProps>>,
) {
class Wrapper extends React.Component<P, State> {
mounted = false;
}
export function withRouter<P extends Partial<WithRouterProps>>(
- WrappedComponent: React.ComponentType<React.PropsWithChildren<React.PropsWithChildren<P>>>,
-): React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<Omit<P, keyof WithRouterProps>>>
-> {
+ WrappedComponent: React.ComponentType<React.PropsWithChildren<P>>,
+): React.ComponentType<React.PropsWithChildren<Omit<P, keyof WithRouterProps>>> {
function ComponentWithRouterProp(props: P) {
const router = useRouter();
const params = useParams();
return <WrappedComponent {...props} location={location} params={params} router={router} />;
}
- (
- ComponentWithRouterProp as React.FC<React.PropsWithChildren<React.PropsWithChildren<P>>>
- ).displayName = getWrappedDisplayName(WrappedComponent, 'withRouter');
+ (ComponentWithRouterProp as React.FC<React.PropsWithChildren<P>>).displayName =
+ getWrappedDisplayName(WrappedComponent, 'withRouter');
return ComponentWithRouterProp;
}
type,
...iconProps
}: IconProps & ProjectLinkIconProps) {
- const getIcon = (): FC<
- React.PropsWithChildren<React.PropsWithChildren<IconProps | MIUIIconProps>>
- > => {
+ const getIcon = (): FC<React.PropsWithChildren<IconProps | MIUIIconProps>> => {
switch (type) {
case 'issue':
return miui ? PulseIcon : BugTrackerIcon;
sections?: RuleDescriptionSection[];
}
-const EDUCATION_PRINCIPLES_MAP: Dict<
- React.ComponentType<React.PropsWithChildren<React.PropsWithChildren<unknown>>>
-> = {
+const EDUCATION_PRINCIPLES_MAP: Dict<React.ComponentType<React.PropsWithChildren>> = {
defense_in_depth: DefenseInDepth,
never_trust_user_input: NeverTrustUserInput,
};
];
const BUILDTOOL_COMPONENT_MAP: {
- [x in BuildTools]: React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<LanguageProps>>
- >;
+ [x in BuildTools]: React.ComponentType<React.PropsWithChildren<LanguageProps>>;
} = {
[BuildTools.Maven]: Maven,
[BuildTools.Gradle]: Gradle,
}
interface WorkspaceHeaderButtonProps {
- icon: React.FC<React.PropsWithChildren<React.PropsWithChildren<IconProps>>>;
+ icon: React.FC<React.PropsWithChildren<IconProps>>;
onClick: () => void;
tooltip: string;
}
import { ComponentClass, FunctionComponent } from 'react';
export type ComponentPropsType<
- T extends
- | ComponentClass
- | FunctionComponent<React.PropsWithChildren<React.PropsWithChildren<any>>>,
+ T extends ComponentClass | FunctionComponent<React.PropsWithChildren<any>>,
> = T extends ComponentClass<infer P>
? P
- : T extends FunctionComponent<React.PropsWithChildren<React.PropsWithChildren<infer P>>>
+ : T extends FunctionComponent<React.PropsWithChildren<infer P>>
? P
: never;
>
>
>,
-): React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<Omit<P, 'branchLike' | 'branchLikes'>>>
-> {
+): React.ComponentType<React.PropsWithChildren<Omit<P, 'branchLike' | 'branchLikes'>>> {
return function WithBranchLike(p: P) {
const { data, isFetching } = useBranchesQuery(p.component);
return (
export function withBranchStatusRefresh<
P extends { refreshBranchStatus: ReturnType<typeof useRefreshBranchStatus> },
>(
- WrappedComponent: React.ComponentType<React.PropsWithChildren<React.PropsWithChildren<P>>>,
-): React.ComponentType<
- React.PropsWithChildren<React.PropsWithChildren<Omit<P, 'refreshBranchStatus'>>>
-> {
+ WrappedComponent: React.ComponentType<React.PropsWithChildren<P>>,
+): React.ComponentType<React.PropsWithChildren<Omit<P, 'refreshBranchStatus'>>> {
return function WithBranchStatusRefresh(props: P) {
const refresh = useRefreshBranchStatus();