Repository: true-myth/true-myth (ts)

Issue:
`Task` incorrectly implements `PromiseLike` interface
Code:

```typescript
import { Task } from 'true-myth'

export const foo: PromiseLike<unknown> = Task.resolve(123)
```

Error:

```plaintext
Type 'Task<number, never>' is not assignable to type 'PromiseLike<unknown>'.
  Type 'Pending<number, never>' is not assignable to type 'PromiseLike<unknown>'.
    Types of property 'then' are incompatible.
      Type '<A, B>(onSuccess?: ((result: Result<number, never>) => A | PromiseLike<A>) | undefined, onRejected?: ((reason: unknown) => B | PromiseLike<B>) | undefined) => PromiseLike<...>' is not assignable to type '<TResult1 = unknown, TResult2 = never>(onfulfilled?: ((value: unknown) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => PromiseLike<...>'.
        Types of parameters 'onSuccess' and 'onfulfilled' are incompatible.
          Type '((value: unknown) => TResult1 | PromiseLike<TResult1>) | null | undefined' is not assignable to type '((result: Result<number, never>) => TResult1 | PromiseLike<TResult1>) | undefined'.
            Type 'null' is not assignable to type '((result: Result<number, never>) => TResult1 | PromiseLike<TResult1>) | undefined'.(2322)
```

Playground link: https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgFQIYGcDWcC+cBmUEIcA5DFAK4CmAtCAJ4wAWpAUG9QB6SxwDGEAHbp4+CBABccAApEQwdNQAywTNQA8lIZiEQA7kIB8cALwoMmAHRRq6CABsAbtQAUARgBMAZgCUQA

Pull request description:
Task: align with `PromiseLike` interface
Fixes #1050

Patch:
diff --git a/src/task.ts b/src/task.ts
index 43c7804..2745090 100644
--- a/src/task.ts
+++ b/src/task.ts
@@ -126,8 +126,8 @@ class TaskImpl<T, E> implements PromiseLike<Result<T, E>> {
   // unwrapping of “thenables” to produce new `Task`s even when there is an
   // intermediate `Promise`.
   then<A, B>(
-    onSuccess?: (result: Result<T, E>) => A | PromiseLike<A>,
-    onRejected?: (reason: unknown) => B | PromiseLike<B>
+    onSuccess?: ((result: Result<T, E>) => A | PromiseLike<A>) | null | undefined,
+    onRejected?: ((reason: unknown) => B | PromiseLike<B>) | null | undefined
   ): PromiseLike<A | B> {
     return this.#promise.then(onSuccess, onRejected);
   }


Test patch:
diff --git a/test/task.test.ts b/test/task.test.ts
index a33f399..3da907c 100644
--- a/test/task.test.ts
+++ b/test/task.test.ts
@@ -100,6 +100,14 @@ describe('`Task`', () => {
     expectTypeOf(result).toEqualTypeOf<Result<string, unknown>>();
     expect(unwrap(result)).toBe('hello');
   });
+  test('assignable to `PromiseLike<Result<A, B>>`', async () => {
+    let result: PromiseLike<Result<string, unknown>> = Task.resolve<string, unknown>('hello');
+    expect(unwrap(await result)).toBe('hello');
+  });
+  test('assignable to `PromiseLike<unknown>`', async () => {
+    let result: PromiseLike<unknown> = Task.resolve<string, unknown>('hello');
+    expect(unwrap(await (result as Task<string, unknown>))).toBe('hello');
+  });
 
   describe('static constructors', () => {
     describe('withResolvers', () => {