You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ npx tsc
main.ts:4:7 - error TS2322: Type 'ResultAsync<number, unknown>' is not assignable to type 'ResultAsync<number, number>'.
Type 'unknown' is not assignable to type 'number'.
4 const b: ResultAsync<number, number> = a.orElse(() => okAsync('A'));
~
main.ts:4:55 - error TS2769: No overload matches this call.
Overload 1 of 3, '(f: (e: number) => Result<number, unknown>): ResultAsync<number, unknown>', gave the following error.
Type 'ResultAsync<string, never>' is not assignable to type 'Result<number, unknown>'.
Type 'ResultAsync<string, never>' is missing the following properties from type 'Err<number, unknown>': error, isOk, isErr, asyncAndThen, and 3 more.
Overload 2 of 3, '(f: (e: number) => ResultAsync<number, unknown>): ResultAsync<number, unknown>', gave the following error.
Type 'ResultAsync<string, never>' is not assignable to type 'ResultAsync<number, unknown>'.
Type 'string' is not assignable to type 'number'.
Overload 3 of 3, '(f: (e: number) => Result<number, never> | ResultAsync<number, never>): ResultAsync<number, never>', gave the following error.
Type 'ResultAsync<string, never>' is not assignable to type 'Result<number, never> | ResultAsync<number, never>'.
Type 'ResultAsync<string, never>' is not assignable to type 'ResultAsync<number, never>'.
Type 'string' is not assignable to type 'number'.
4 const b: ResultAsync<number, number> = a.orElse(() => okAsync('A'));
~~~~~~~~~~~~
node_modules/neverthrow/dist/index.d.ts:19:45
19 orElse<R extends Result<T, unknown>>(f: (e: E) => R): ResultAsync<T, InferErrTypes<R>>;
~~~~~~~~~~~
The expected type comes from the return type of this signature.
node_modules/neverthrow/dist/index.d.ts:20:50
20 orElse<R extends ResultAsync<T, unknown>>(f: (e: E) => R): ResultAsync<T, InferAsyncErrTypes<R>>;
~~~~~~~~~~~
The expected type comes from the return type of this signature.
node_modules/neverthrow/dist/index.d.ts:21:18
21 orElse<A>(f: (e: E) => Result<T, A> | ResultAsync<T, A>): ResultAsync<T, A>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The expected type comes from the return type of this signature.
Found 2 errors in the same file, starting at: main.ts:4
The text was updated successfully, but these errors were encountered:
Result
is broken. It doesn't track ok type changes.The ok type of
b
isstring
, but TypeScript thinks it isnumber
.ResultAsync
is fine. It rejects ok type changes.The text was updated successfully, but these errors were encountered: