@itrocks/class-type
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -44,3 +44,3 @@ { | ||
"types": "./esm/class-type.d.ts", | ||
"version": "0.0.5" | ||
"version": "0.0.6" | ||
} |
@@ -164,2 +164,19 @@ [![npm version](https://img.shields.io/npm/v/@itrocks/class-type?logo=npm)](https://www.npmjs.org/package/@itrocks/class-type) | ||
### inherits | ||
```ts | ||
function inherits(type: Type, superType: Type): boolean | ||
``` | ||
Checks if a class (or [Type](#type)) is derived from another class [class](#type), mimicking the behaviour of | ||
[instanceof](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/instanceof), | ||
but operating at the class level. | ||
**Parameters:** | ||
- `type`: The class whose inheritance chain will be checked | ||
- `superType`: The parent class to check against. | ||
**Returns:** | ||
- `boolean`: Returns `true` if `type` is equal to or inherits from `superType`, otherwise `false`. | ||
### isAnyFunction | ||
@@ -166,0 +183,0 @@ |
17114
309