Files
reacord/packages/helpers/is-instance-of.ts
2022-07-27 22:42:35 -05:00

8 lines
202 B
TypeScript

/**
* for narrowing instance types with array.filter
*/
export const isInstanceOf =
<T>(Constructor: new (...args: any[]) => T) =>
(value: unknown): value is T =>
value instanceof Constructor