File tree Expand file tree Collapse file tree 3 files changed +50
-1
lines changed Expand file tree Collapse file tree 3 files changed +50
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @effect/platform " : patch
3+ ---
4+
5+ Support ` HttpApiError ` unification
Original file line number Diff line number Diff line change 1+ import type { HttpApiError } from "@effect/platform"
2+
3+ import type { Unify } from "effect"
4+
5+ import { describe , expect , it } from "tstyche"
6+
7+ describe ( "HttpApiError" , ( ) => {
8+ describe ( "Unify" , ( ) => {
9+ it ( "should unify error types" , ( ) => {
10+ type testType = Unify . Unify < HttpApiError . NotFound | HttpApiError . RequestTimeout >
11+ expect < testType > ( )
12+ . type . toBe < HttpApiError . NotFound | HttpApiError . RequestTimeout > ( )
13+ } )
14+ } )
15+ } )
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import { hasProperty } from "effect/Predicate"
1212import * as Schema from "effect/Schema"
1313import * as AST from "effect/SchemaAST"
1414import * as Struct from "effect/Struct"
15+ import type * as Unify from "effect/Unify"
1516import type * as FileSystem from "./FileSystem.js"
1617import type * as Multipart_ from "./Multipart.js"
1718
@@ -601,12 +602,40 @@ export const deunionize = (
601602 }
602603}
603604
605+ /**
606+ * @since 1.0.0
607+ * @category empty errors
608+ */
609+ export interface EmptyError < Self , Tag > extends Effect . Effect < never , Self > {
610+ readonly _tag : Tag
611+ [ Unify . typeSymbol ] ?: unknown
612+ [ Unify . unifySymbol ] ?: EmptyErrorUnify < this>
613+ [ Unify . ignoreSymbol ] ?: EmptyErrorUnifyIgnore
614+ }
615+
616+ /**
617+ * @category models
618+ * @since 1.0.0
619+ */
620+ export interface EmptyErrorUnify < A extends { [ Unify . typeSymbol ] ?: any } > extends Effect . EffectUnify < A > {
621+ EmptyError ?: ( ) => A [ Unify . typeSymbol ] extends EmptyError < infer Self , infer _Tag > | infer _ ? Self
622+ : never
623+ }
624+
604625/**
605626 * @since 1.0.0
606627 * @category empty errors
607628 */
608629export interface EmptyErrorClass < Self , Tag > extends Schema . Schema < Self , void > {
609- new ( _ : void ) : { readonly _tag : Tag } & Effect . Effect < never , Self >
630+ new ( _ : void ) : EmptyError < Self , Tag >
631+ }
632+
633+ /**
634+ * @category models
635+ * @since 1.0.0
636+ */
637+ export interface EmptyErrorUnifyIgnore extends Effect . EffectUnifyIgnore {
638+ Effect ?: true
610639}
611640
612641/**
You can’t perform that action at this time.
0 commit comments