Type alias OmitExactlyByTypeDeep<T, P>

OmitExactlyByTypeDeep<T, P>: {
    [K in Keys<T> as IfEquals<T[K], P, never, K>]: OmitExactlyByTypeDeep<T[K], P>
}

Get a set of properties from T whose type exactly matches P.

Type Parameters

  • T
  • P

Example

type deep = {
isActive: boolean;
count?: number;
description: string | null;
details: {
id: bigint;
name: string;
nested: {
title: string;
subtitle: string;
moreDetails: {
numberId: bigint;
};
};
};
additionalInfo: string | boolean;
}
type A = OmitExactlyByTypeDeep<deep, bigint>
// A results in:
{
isActive: boolean;
count?: number;
description: string | null;
details: {
name: string;
nested: {
title: string;
subtitle: string;
moreDetails: EmptyObject;
};
};
additionalInfo: string | boolean;
}