MCPcopy Create free account
hub / github.com/Effect-TS/effect / refine

Function refine

packages/effect/src/Schema.ts:5171–5177  ·  view source on GitHub ↗
(
  refinement: (value: S["Type"]) => value is T,
  annotations?: Annotations.Filter
)

Source from the content-addressed store, hash-verified

5169 * @since 3.10.0
5170 */
5171export function refine<S extends Constraint, T extends S["Type"]>(
5172 refinement: (value: S["Type"]) => value is T,
5173 annotations?: Annotations.Filter
5174) {
5175 return (schema: S): refine<T, S> =>
5176 make(SchemaAST.appendChecks(schema.ast, [SchemaAST.makeFilterByGuard(refinement, annotations)]), { schema })
5177}
5178
5179type DistributeBrands<B> = UnionToIntersection<B extends infer U extends string ? Brand.Brand<U> : never>
5180

Callers

nothing calls this directly

Calls 1

makeFunction · 0.70

Tested by

no test coverage detected