import { Option, OptionPromise } from "./option/api"; import { Result, ResultPromise } from "./result/api"; export type OptionPromiseLike = Promise> | OptionPromise; export type OptionLike = Option | OptionPromiseLike; export type ResultPromiseLike = Promise> | ResultPromise; export type ResultLike = Result | ResultPromiseLike; export type MapOption = U extends Promise> ? OptionPromise : U extends Promise ? OptionPromise

: U extends Option ? Option : Option; export type OptionFrom = U extends Promise> | OptionPromise ? OptionPromise : U extends Promise ? OptionPromise : U extends Option ? Option : Option; export type OkFrom = U extends Promise> | ResultPromise ? ResultPromise : U extends Promise ? ResultPromise : U extends Result ? Result : Result; export type ErrFrom = E extends Promise> | ResultPromise ? ResultPromise : E extends Promise ? ResultPromise : E extends Result ? Result : Result; type OptionPromiseShouldUseMapOption = "To return a Promise to an Option, use mapOption"; type OptionLikeShouldUseMapOption = "To return (a Promise to) an Option, use mapOption"; type ResultPromiseShouldUseMapResult = "To return a Promise to a Result, use mapResult"; type ResultLikeShouldUseMapResult = "To return (a Promise to) a Result, use mapResult"; type NoOptionPromiseShouldUseMapOrElse = "To return a promise to anything other than Option, use mapOrElse"; type NoResultPromiseShouldUseMapOrElse = "To return a promise to anything other than Result, use mapOrElse"; export type OptionMapOrElse = T extends OptionPromiseLike ? OptionPromiseShouldUseMapOption : T extends ResultPromiseLike ? ResultPromiseShouldUseMapResult : T; export type ResultMapOrElse = T extends ResultPromiseLike ? ResultPromiseShouldUseMapResult : T extends OptionLike ? OptionPromiseShouldUseMapOption : T; export type OptionPromiseMapOrElse = T extends OptionLike ? OptionLikeShouldUseMapOption : T extends ResultLike ? ResultLikeShouldUseMapResult : T extends Promise ? Promise

: Promise; export type ResultPromiseMapOrElse = T extends ResultLike ? ResultLikeShouldUseMapResult : T extends OptionLike ? OptionLikeShouldUseMapOption : T extends Promise ? Promise

: Promise; export type OptionMapOption = T extends OptionPromiseLike ? OptionPromise : T extends ResultPromiseLike ? ResultPromiseShouldUseMapResult : T extends Promise ? OptionPromise

: T; export type ResultMapOption = T extends OptionPromiseLike ? OptionPromise : T extends ResultPromiseLike ? ResultPromiseShouldUseMapResult : T extends Promise ? NoResultPromiseShouldUseMapOrElse : T; export type OptionPromiseMapOption = T extends OptionLike ? OptionPromise : T extends ResultLike ? ResultLikeShouldUseMapResult : T extends Promise ? OptionPromise

: OptionPromise; export type ResultPromiseMapOption = T extends OptionLike ? OptionPromise : T extends ResultLike ? ResultLikeShouldUseMapResult : T extends Promise ? NoResultPromiseShouldUseMapOrElse : Promise; export type OptionMapResult = T extends ResultPromiseLike ? ResultPromise : T extends OptionPromiseLike ? OptionPromiseShouldUseMapOption : T extends Promise ? ResultPromise : T; export type ResultMapResult = T extends ResultPromiseLike ? ResultPromise : T extends OptionPromiseLike ? OptionPromiseShouldUseMapOption : T extends Promise ? NoResultPromiseShouldUseMapOrElse : T; export type OptionPromiseMapResult = T extends ResultLike ? ResultPromise : T extends OptionLike ? OptionLikeShouldUseMapOption : T extends Promise ? ResultPromise : ResultPromise; export type ResultPromiseMapResult = T extends ResultLike ? ResultPromise : T extends OptionLike ? OptionLikeShouldUseMapOption : T extends Promise ? NoOptionPromiseShouldUseMapOrElse : Promise; export {};