()
| 487 | * @since 4.0.0 |
| 488 | */ |
| 489 | export function declareConstructor<T, E = T, Iso = T>() { |
| 490 | return <const TypeParameters extends ReadonlyArray<Constraint>>( |
| 491 | typeParameters: TypeParameters, |
| 492 | run: ( |
| 493 | typeParameters: { |
| 494 | readonly [K in keyof TypeParameters]: Codec<TypeParameters[K]["Type"], TypeParameters[K]["Encoded"]> |
| 495 | } |
| 496 | ) => ( |
| 497 | u: unknown, |
| 498 | self: SchemaAST.Declaration, |
| 499 | options: SchemaAST.ParseOptions |
| 500 | ) => Effect.Effect<T, SchemaIssue.Issue>, |
| 501 | annotations?: Annotations.Declaration<T, TypeParameters> |
| 502 | ): declareConstructor<T, E, TypeParameters, Iso> => { |
| 503 | return make( |
| 504 | new SchemaAST.Declaration( |
| 505 | typeParameters.map(SchemaAST.getAST), |
| 506 | (typeParameters) => run(typeParameters.map((ast) => make(ast)) as any), |
| 507 | annotations |
| 508 | ) |
| 509 | ) |
| 510 | } |
| 511 | } |
| 512 | |
| 513 | /** |
| 514 | * Type-level representation returned by {@link declare}. |
no test coverage detected