Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/maybe/maybe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class Maybe<T> implements IMaybe<T> {
: pattern.some(this.value as NonNullable<T>)
}

public toArray() {
public toArray(): ReadonlyArray<T> {
return this.isNone()
? []
: Array.isArray(this.value)
Expand Down
8 changes: 4 additions & 4 deletions src/result/result.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,19 @@ describe('result', () => {
})

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

expect(_sut).toEqual('Some Other1')
expect(sut).toEqual('Some Other1')
})

it('should return fail object when "maybeFail" is invoked', () => {
const _sut = fail('Test')
const sut = fail<string, string>('Test')
.maybeFail()
.valueOr('Some Other2')

expect(_sut).toEqual('Test')
expect(sut).toEqual('Test')
})

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