@effect/data
Advanced tools
Comparing version 0.11.8 to 0.12.0
{ | ||
"name": "@effect/data", | ||
"version": "0.11.8", | ||
"version": "0.12.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -5,3 +5,2 @@ /** | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
import type * as Context from "@effect/data/Context" | ||
@@ -35,13 +34,52 @@ import type * as Either from "@effect/data/Either" | ||
*/ | ||
export type Unify<A> = ReturnType< | ||
NonNullable< | ||
export declare const blacklistSymbol: unique symbol | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export type blacklistSymbol = typeof blacklistSymbol | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export type MaybeReturn<F> = F extends () => any ? ReturnType<F> : F | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export type Values<X extends [any, any]> = X extends any | ||
? { [k in keyof X[0]]-?: k extends X[1] ? never : MaybeReturn<X[0][k]> }[keyof X[0]] | ||
: never | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export type Blacklist<X> = X extends { | ||
[blacklistSymbol]?: any | ||
} ? keyof NonNullable<X[blacklistSymbol]> | ||
: never | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export type ExtractTypes< | ||
X extends { | ||
[typeSymbol]?: any | ||
[unifySymbol]?: any | ||
} | ||
> = X extends any ? [ | ||
NonNullable<X[unifySymbol]>, | ||
Blacklist<X> | ||
] | ||
: never | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export type Unify<A> = Values< | ||
ExtractTypes< | ||
( | ||
& Extract<A, { | ||
[typeSymbol]?: any | ||
[unifySymbol]?: () => any | ||
}> | ||
& { | ||
[typeSymbol]: A | ||
} | ||
)[unifySymbol] | ||
& Extract<A, { [typeSymbol]?: any; [unifySymbol]?: any }> | ||
& { [typeSymbol]: A } | ||
) | ||
> | ||
@@ -51,33 +89,42 @@ > extends infer Z ? Z | Exclude<A, Z> : never | ||
declare module "@effect/data/Either" { | ||
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */ | ||
interface Left<E, A> { | ||
[typeSymbol]?: unknown | ||
[unifySymbol]?: () => this[typeSymbol] extends Either.Either<infer E0, infer A0> | infer Z ? Either.Either<E0, A0> | ||
: never | ||
[unifySymbol]?: UnifyEither<this> | ||
} | ||
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */ | ||
interface Right<E, A> { | ||
[typeSymbol]?: unknown | ||
[unifySymbol]?: () => this[typeSymbol] extends Either.Either<infer E0, infer A0> | infer _ ? Either.Either<E0, A0> | ||
: never | ||
[unifySymbol]?: UnifyEither<this> | ||
} | ||
interface UnifyEither<A extends { [typeSymbol]?: any }> { | ||
Either?: () => A[typeSymbol] extends Either.Either<infer E0, infer A0> | infer _ ? Either.Either<E0, A0> : never | ||
} | ||
} | ||
declare module "@effect/data/Context" { | ||
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */ | ||
interface Tag<Identifier, Service> { | ||
[typeSymbol]?: unknown | ||
[unifySymbol]?: () => this[typeSymbol] extends Context.Tag<infer I0, infer S0> | infer _ ? Context.Tag<I0, S0> | ||
: never | ||
[unifySymbol]?: UnifyTag<this> | ||
} | ||
interface UnifyTag<A extends { [typeSymbol]?: any }> { | ||
Tag?: () => A[typeSymbol] extends Context.Tag<infer I0, infer S0> | infer _ ? Context.Tag<I0, S0> : never | ||
} | ||
} | ||
declare module "@effect/data/Option" { | ||
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */ | ||
interface Some<A> { | ||
[typeSymbol]?: unknown | ||
[unifySymbol]?: () => this[typeSymbol] extends Option.Option<infer A0> | infer Z ? Option.Option<A0> | ||
: never | ||
[unifySymbol]?: UnifyOption<this> | ||
} | ||
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */ | ||
interface None<A> { | ||
[typeSymbol]?: unknown | ||
[unifySymbol]?: () => this[typeSymbol] extends Option.Option<infer A0> | infer Z ? Option.Option<A0> | ||
: never | ||
[unifySymbol]?: UnifyOption<this> | ||
} | ||
interface UnifyOption<A extends { [typeSymbol]?: any }> { | ||
Option?: () => A[typeSymbol] extends Option.Option<infer A0> | infer _ ? Option.Option<A0> : never | ||
} | ||
} | ||
@@ -84,0 +131,0 @@ |
@@ -26,3 +26,3 @@ { | ||
"noEmitOnError": false, | ||
"noErrorTruncation": false, | ||
"noErrorTruncation": true, | ||
"allowJs": false, | ||
@@ -29,0 +29,0 @@ "checkJs": false, |
@@ -26,17 +26,56 @@ /** | ||
*/ | ||
export type Unify<A> = ReturnType<NonNullable<(Extract<A, { | ||
export declare const blacklistSymbol: unique symbol; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export type blacklistSymbol = typeof blacklistSymbol; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export type MaybeReturn<F> = F extends () => any ? ReturnType<F> : F; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export type Values<X extends [any, any]> = X extends any ? { | ||
[k in keyof X[0]]-?: k extends X[1] ? never : MaybeReturn<X[0][k]>; | ||
}[keyof X[0]] : never; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export type Blacklist<X> = X extends { | ||
[blacklistSymbol]?: any; | ||
} ? keyof NonNullable<X[blacklistSymbol]> : never; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export type ExtractTypes<X extends { | ||
[typeSymbol]?: any; | ||
[unifySymbol]?: () => any; | ||
[unifySymbol]?: any; | ||
}> = X extends any ? [ | ||
NonNullable<X[unifySymbol]>, | ||
Blacklist<X> | ||
] : never; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export type Unify<A> = Values<ExtractTypes<(Extract<A, { | ||
[typeSymbol]?: any; | ||
[unifySymbol]?: any; | ||
}> & { | ||
[typeSymbol]: A; | ||
})[unifySymbol]>> extends infer Z ? Z | Exclude<A, Z> : never; | ||
})>> extends infer Z ? Z | Exclude<A, Z> : never; | ||
declare module "@effect/data/Either" { | ||
interface Left<E, A> { | ||
[typeSymbol]?: unknown; | ||
[unifySymbol]?: () => this[typeSymbol] extends Either.Either<infer E0, infer A0> | infer Z ? Either.Either<E0, A0> : never; | ||
[unifySymbol]?: UnifyEither<this>; | ||
} | ||
interface Right<E, A> { | ||
[typeSymbol]?: unknown; | ||
[unifySymbol]?: () => this[typeSymbol] extends Either.Either<infer E0, infer A0> | infer _ ? Either.Either<E0, A0> : never; | ||
[unifySymbol]?: UnifyEither<this>; | ||
} | ||
interface UnifyEither<A extends { | ||
[typeSymbol]?: any; | ||
}> { | ||
Either?: () => A[typeSymbol] extends Either.Either<infer E0, infer A0> | infer _ ? Either.Either<E0, A0> : never; | ||
} | ||
} | ||
@@ -46,4 +85,9 @@ declare module "@effect/data/Context" { | ||
[typeSymbol]?: unknown; | ||
[unifySymbol]?: () => this[typeSymbol] extends Context.Tag<infer I0, infer S0> | infer _ ? Context.Tag<I0, S0> : never; | ||
[unifySymbol]?: UnifyTag<this>; | ||
} | ||
interface UnifyTag<A extends { | ||
[typeSymbol]?: any; | ||
}> { | ||
Tag?: () => A[typeSymbol] extends Context.Tag<infer I0, infer S0> | infer _ ? Context.Tag<I0, S0> : never; | ||
} | ||
} | ||
@@ -53,8 +97,13 @@ declare module "@effect/data/Option" { | ||
[typeSymbol]?: unknown; | ||
[unifySymbol]?: () => this[typeSymbol] extends Option.Option<infer A0> | infer Z ? Option.Option<A0> : never; | ||
[unifySymbol]?: UnifyOption<this>; | ||
} | ||
interface None<A> { | ||
[typeSymbol]?: unknown; | ||
[unifySymbol]?: () => this[typeSymbol] extends Option.Option<infer A0> | infer Z ? Option.Option<A0> : never; | ||
[unifySymbol]?: UnifyOption<this>; | ||
} | ||
interface UnifyOption<A extends { | ||
[typeSymbol]?: any; | ||
}> { | ||
Option?: () => A[typeSymbol] extends Option.Option<infer A0> | infer _ ? Option.Option<A0> : never; | ||
} | ||
} | ||
@@ -61,0 +110,0 @@ /** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3663475
77882