From 86623a5ebd6548e4be41dc1c1aa2b41810612766 Mon Sep 17 00:00:00 2001 From: Antonio Barcelos Date: Fri, 3 Sep 2021 17:03:48 +0200 Subject: [PATCH] Fix issues which are blocking the build pipeline The wrong typecasting the `record.ts` was giving a `Type 'any' cannot be used to index type 'Entries'.` during the build. And it was fixed just by adjusting the type casting. The test case `Result Promise should call finally on error` was not handling correctly the error before call finally and it was giving `Unhandled promise rejection` error during the tests. --- core/src/record.ts | 6 +++--- core/test/result.test.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/record.ts b/core/src/record.ts index 8edf84cef..7df54286a 100644 --- a/core/src/record.ts +++ b/core/src/record.ts @@ -110,7 +110,7 @@ class Record< */ forEach(visitor: Visitor): void { for (const [key, value] of this.entries()) { - visitor(value as any, key as any, this) + visitor(value, key as Key, this) } } @@ -128,7 +128,7 @@ class Record< const resultArray = [] for (const [key, value] of this.entries()) { - resultArray.push(visitor(value as any, key as any, this)) + resultArray.push(visitor(value, key as Key, this)) } return resultArray @@ -180,7 +180,7 @@ class Record< const obj: Entries = {} as Entries for (const [key, value] of this.entries()) { - obj[key as any] = value + obj[key as Key] = value } return obj diff --git a/core/test/result.test.ts b/core/test/result.test.ts index 2f685a461..c485eaf10 100644 --- a/core/test/result.test.ts +++ b/core/test/result.test.ts @@ -407,7 +407,7 @@ describe('Result', () => { it('should call finally on error', done => { streamObserverMock.onError(expectedError) - result.finally(done) + result.catch(() => {}).finally(done) }) describe.each([