Skip to content

Commit

Permalink
add dtslint tests for separate, getRights, getLefts, getSomes (#2825)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed May 23, 2024
1 parent 608b01f commit 39f715e
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions packages/effect/dtslint/Array.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as Array from "effect/Array"
import * as Effect from "effect/Effect"
import * as Either from "effect/Either"
import * as Equal from "effect/Equal"
import { hole, identity, pipe } from "effect/Function"
import * as Option from "effect/Option"
Expand Down Expand Up @@ -1221,3 +1222,67 @@ pipe(
b // $ExpectType number
) => [a, b] as [string, number])
)

// -------------------------------------------------------------------------------------
// separate
// -------------------------------------------------------------------------------------

// $ExpectType [unknown[], unknown[]]
Array.separate([])

// $ExpectType [string[], number[]]
Array.separate([Either.left("a"), Either.right(1)])

// $ExpectType [string[], number[]]
Array.separate(hole<Array<Either.Either<number, string>>>())

// $ExpectType [string[], number[]]
Array.separate(hole<Iterable<Either.Either<number, string>>>())

// -------------------------------------------------------------------------------------
// getRights
// -------------------------------------------------------------------------------------

// $ExpectType unknown[]
Array.getRights([])

// $ExpectType number[]
Array.getRights([Either.left("a"), Either.right(1)])

// $ExpectType number[]
Array.getRights(hole<Array<Either.Either<number, string>>>())

// $ExpectType number[]
Array.getRights(hole<Iterable<Either.Either<number, string>>>())

// -------------------------------------------------------------------------------------
// getLefts
// -------------------------------------------------------------------------------------

// $ExpectType unknown[]
Array.getLefts([])

// $ExpectType string[]
Array.getLefts([Either.left("a"), Either.right(1)])

// $ExpectType string[]
Array.getLefts(hole<Array<Either.Either<number, string>>>())

// $ExpectType string[]
Array.getLefts(hole<Iterable<Either.Either<number, string>>>())

// -------------------------------------------------------------------------------------
// getSomes
// -------------------------------------------------------------------------------------

// $ExpectType unknown[]
Array.getSomes([])

// $ExpectType number[]
Array.getSomes([Option.none(), Option.some(1)])

// $ExpectType number[]
Array.getSomes(hole<Array<Option.Option<number>>>())

// $ExpectType number[]
Array.getSomes(hole<Iterable<Option.Option<number>>>())

0 comments on commit 39f715e

Please sign in to comment.