MCPcopy
hub / github.com/Effect-TS/effect / instanceOf

Function instanceOf

packages/effect/src/Schema.ts:1154–1168  ·  view source on GitHub ↗
(
  constructor: A,
  annotations?: Annotations.Schema<InstanceType<A>>
)

Source from the content-addressed store, hash-verified

1152 * @since 3.10.0
1153 */
1154export 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

Callers 1

URLFromSelfClass · 0.70

Calls 1

declareInterface · 0.85

Tested by

no test coverage detected