Skip to content

Commit 267b5a3

Browse files
fix: return ReadonlyArray<T> in toArray (#141)
1 parent 804f5d4 commit 267b5a3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/maybe/maybe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export class Maybe<T> implements IMaybe<T> {
6666
: pattern.some(this.value as NonNullable<T>)
6767
}
6868

69-
public toArray() {
69+
public toArray(): ReadonlyArray<T> {
7070
return this.isNone()
7171
? []
7272
: Array.isArray(this.value)

src/result/result.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,19 @@ describe('result', () => {
8585
})
8686

8787
it('should return empty maybe when "maybeOk" is invoked', () => {
88-
const _sut = fail('Test')
88+
const sut = fail<string, string>('Test')
8989
.maybeOk()
9090
.valueOr('Some Other1')
9191

92-
expect(_sut).toEqual('Some Other1')
92+
expect(sut).toEqual('Some Other1')
9393
})
9494

9595
it('should return fail object when "maybeFail" is invoked', () => {
96-
const _sut = fail('Test')
96+
const sut = fail<string, string>('Test')
9797
.maybeFail()
9898
.valueOr('Some Other2')
9999

100-
expect(_sut).toEqual('Test')
100+
expect(sut).toEqual('Test')
101101
})
102102

103103
it('should throw an exception on "unwrap"', () => {

0 commit comments

Comments
 (0)