Files
reacord/packages/reacord/helpers/is-instance-of.ts
MapleLeaf 88e9919c8f workspace
2021-12-29 13:19:46 -06: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