Skip to content

Commit

Permalink
feat: Add OmitFunctionMembers helper type
Browse files Browse the repository at this point in the history
  • Loading branch information
spuxx1701 committed Aug 19, 2024
1 parent 0d3cdd7 commit 13fd2fc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/js-utils/src/types/public/helper-types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/ban-types */
/**
* A type that extracts the optional properties from another type.
*/
Expand All @@ -10,3 +11,10 @@ export type OptionalProperties<T> = {
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type Constructor<T = any> = new (...args: any[]) => T;

/**
* Creates a subsidiary type that omits all function members from a given type.
*/
export type OmitFunctionMembers<T> = {
[K in keyof T as T[K] extends Function ? never : K]: T[K];
};

0 comments on commit 13fd2fc

Please sign in to comment.