| 1152 | * @since 3.10.0 |
| 1153 | */ |
| 1154 | export const instanceOf = <A extends abstract new(...args: any) => any>( |
| 1155 | constructor: A, |
| 1156 | annotations?: Annotations.Schema<InstanceType<A>> |
| 1157 | ): instanceOf<InstanceType<A>> => |
| 1158 | declare( |
| 1159 | (u): u is InstanceType<A> => u instanceof constructor, |
| 1160 | { |
| 1161 | title: constructor.name, |
| 1162 | description: `an instance of ${constructor.name}`, |
| 1163 | pretty: (): pretty_.Pretty<InstanceType<A>> => String, |
| 1164 | schemaId: InstanceOfSchemaId, |
| 1165 | [InstanceOfSchemaId]: { constructor }, |
| 1166 | ...annotations |
| 1167 | } |
| 1168 | ) |
| 1169 | |
| 1170 | /** |
| 1171 | * @category primitives |