Skip to main content

Utility Types

This document documents various smaller utility types

FilterOutFunctionKeys<T>

Typings:

type FilterOutFunctionKeys<T extends object> = Omit<T, GetFunctionKeys<T>>

Parameters:

NameTypeDescription
T RequiredobjectThe type to filter functions out of

The type FilterOutFunctionKeys<T> can be used where function types need to be filtered-out, for example for AnyBulkWriteOperation.

Example:

class Kitten {
@prop()
public name?: string;

public getName() {
return this.name;
}
}

type Normal = Pick<Kitten, typeof Kitten>;
// type:
// {
// name: string | undefined,
// getName: () => string
// }

type Filtered = FilterOutFunctionKeys<Kitten>;
// type:
// {
// name: string | undefined
// }

This type may be used in the future for DocumentType.