()
| 522 | * @since 4.0.0 |
| 523 | */ |
| 524 | export function declareConstructor<T, E = T, Iso = T>() { |
| 525 | return <const TypeParameters extends ReadonlyArray<Constraint>>( |
| 526 | typeParameters: TypeParameters, |
| 527 | run: ( |
| 528 | typeParameters: { |
| 529 | readonly [K in keyof TypeParameters]: Codec<TypeParameters[K]["Type"], TypeParameters[K]["Encoded"]> |
| 530 | } |
| 531 | ) => ( |
| 532 | u: unknown, |
| 533 | self: SchemaAST.Declaration, |
| 534 | options: SchemaAST.ParseOptions |
| 535 | ) => Effect.Effect<T, SchemaIssue.Issue>, |
| 536 | annotations?: Annotations.Declaration<T, TypeParameters> |
| 537 | ): declareConstructor<T, E, TypeParameters, Iso> => { |
| 538 | return make( |
| 539 | new SchemaAST.Declaration( |
| 540 | typeParameters.map(SchemaAST.getAST), |
| 541 | (typeParameters) => run(typeParameters.map((ast) => make(ast)) as any), |
| 542 | annotations |
| 543 | ) |
| 544 | ) |
| 545 | } |
| 546 | } |
| 547 | /** |
| 548 | * Type-level representation returned by {@link declare}. |
| 549 | * |
no test coverage detected