Skip to content

Commit 13fd2fc

Browse files
committed
feat: Add OmitFunctionMembers helper type
1 parent 0d3cdd7 commit 13fd2fc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/js-utils/src/types/public/helper-types.ts

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/ban-types */
12
/**
23
* A type that extracts the optional properties from another type.
34
*/
@@ -10,3 +11,10 @@ export type OptionalProperties<T> = {
1011
*/
1112
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1213
export type Constructor<T = any> = new (...args: any[]) => T;
14+
15+
/**
16+
* Creates a subsidiary type that omits all function members from a given type.
17+
*/
18+
export type OmitFunctionMembers<T> = {
19+
[K in keyof T as T[K] extends Function ? never : K]: T[K];
20+
};

0 commit comments

Comments
 (0)