Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Zemnmez
Created November 6, 2021 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zemnmez/b703546028b8017fde35c3e1751a10fe to your computer and use it in GitHub Desktop.
Save Zemnmez/b703546028b8017fde35c3e1751a10fe to your computer and use it in GitHub Desktop.
Argument of type '(i: readonly string[]) => Errors<readonly [Error, Error]> | (readonly [() => readonly (readonly [out: "A", newIn: readonly string[]])[] | SymbolError<"A", Expected<"A">>, string[]] | readonly [() => readonly (readonly [out: "B", newIn: readonly string[]])[] | SymbolError<...>, string[]])[]' is not assignable to parameter of type '(t: readonly string[]) => Errors<readonly [Error, Error]> | readonly (readonly [out: () => readonly (readonly [out: "A", newIn: readonly string[]])[] | SymbolError<"A", Expected<"A">>, newIn: readonly string[]])[]'.
Type 'Errors<readonly [Error, Error]> | (readonly [() => readonly (readonly [out: "A", newIn: readonly string[]])[] | SymbolError<"A", Expected<"A">>, string[]] | readonly [() => readonly (readonly [out: "B", newIn: readonly string[]])[] | SymbolError<"B", Expected<...>>, string[]])[]' is not assignable to type 'Errors<readonly [Error, Error]> | readonly (readonly [out: () => readonly (readonly [out: "A", newIn: readonly string[]])[] | SymbolError<"A", Expected<"A">>, newIn: readonly string[]])[]'.
Type '(readonly [() => readonly (readonly [out: "A", newIn: readonly string[]])[] | SymbolError<"A", Expected<"A">>, string[]] | readonly [() => readonly (readonly [out: "B", newIn: readonly string[]])[] | SymbolError<"B", Expected<"B">>, string[]])[]' is not assignable to type 'Errors<readonly [Error, Error]> | readonly (readonly [out: () => readonly (readonly [out: "A", newIn: readonly string[]])[] | SymbolError<"A", Expected<"A">>, newIn: readonly string[]])[]'.
Type '(readonly [() => readonly (readonly [out: "A", newIn: readonly string[]])[] | SymbolError<"A", Expected<"A">>, string[]] | readonly [() => readonly (readonly [out: "B", newIn: readonly string[]])[] | SymbolError<"B", Expected<"B">>, string[]])[]' is not assignable to type 'readonly (readonly [out: () => readonly (readonly [out: "A", newIn: readonly string[]])[] | SymbolError<"A", Expected<"A">>, newIn: readonly string[]])[]'.
Type 'readonly [() => readonly (readonly [out: "A", newIn: readonly string[]])[] | SymbolError<"A", Expected<"A">>, string[]] | readonly [() => readonly (readonly [out: "B", newIn: readonly string[]])[] | SymbolError<"B", Expected<"B">>, string[]]' is not assignable to type 'readonly [out: () => readonly (readonly [out: "A", newIn: readonly string[]])[] | SymbolError<"A", Expected<"A">>, newIn: readonly string[]]'.
Type 'readonly [() => readonly (readonly [out: "B", newIn: readonly string[]])[] | SymbolError<"B", Expected<"B">>, string[]]' is not assignable to type 'readonly [out: () => readonly (readonly [out: "A", newIn: readonly string[]])[] | SymbolError<"A", Expected<"A">>, newIn: readonly string[]]'.
Type at position 0 in source is not compatible with type at position 0 in target.
Type 'readonly (readonly [out: "B", newIn: readonly string[]])[] | SymbolError<"B", Expected<"B">>' is not assignable to type 'readonly (readonly [out: "A", newIn: readonly string[]])[] | SymbolError<"A", Expected<"A">>'.
Type 'readonly (readonly [out: "B", newIn: readonly string[]])[]' is not assignable to type 'readonly (readonly [out: "A", newIn: readonly string[]])[] | SymbolError<"A", Expected<"A">>'.
Type 'readonly (readonly [out: "B", newIn: readonly string[]])[]' is not assignable to type 'readonly (readonly [out: "A", newIn: readonly string[]])[]'.
Type 'readonly [out: "B", newIn: readonly string[]]' is not assignable to type 'readonly [out: "A", newIn: readonly string[]]'.
Type at position 0 in source is not compatible with type at position 0 in target.
Type '"B"' is not assignable to type '"A"'.(2345)
function Either<readonly string[], readonly [() => readonly (readonly [out: "A", newIn: readonly string[]])[] | SymbolError<"A", Expected<"A">>, string[]], Error, readonly string[], readonly [() => readonly (readonly [out: "B", newIn: readonly string[]])[] | SymbolError<"B", Expected<"B">>, string[]], Error>(a: (i: readonly string[]) => Error | readonly (readonly [...])[], b: (i: readonly string[]) => Error | readonly (readonly [...])[]): (i: readonly string[]) => (readonly [...] | readonly [...])[] | Errors<...>
Either represents an operation that can be A or B, which may themselves have ambiguous results (represented as an array).
Either returns no error and the result of A and B if both succeed; if one fails, it is omitted. If both fail, both errors are returned.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment