Skip to content

Commit

Permalink
fix failing type-level tests (Effect-TS#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti authored Apr 26, 2023
1 parent 6c33bb0 commit d04aecc
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 59 deletions.
3 changes: 0 additions & 3 deletions dtslint/ts4.9/Option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,3 @@ pipe(
) => true
)
)

// $ExpectType _.Option<string | number>
declare const unified: U.Unify<_.Option<number> | _.Option<string>>
16 changes: 8 additions & 8 deletions dtslint/ts4.9/Unify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import * as Option from '@effect/data/Option'
import * as Either from '@effect/data/Either'
import * as Unify from '@effect/data/Unify'

// $ExpectType Option.Option<string | number>
declare const option: Unify.Unify<Option.Option<number> | Option.Option<string>>
// $ExpectType Option<string | number>
type option = Unify.Unify<Option.Option<number> | Option.Option<string>>

// $ExpectType Either.Either<"LA" | "LB", "RA" | "RB">
declare const either: Unify.Unify<Either.Either<"LA", "RA"> | Either.Either<"LB", "RB">>
// $ExpectType Either<"LA" | "LB", "RA" | "RB">
type either = Unify.Unify<Either.Either<"LA", "RA"> | Either.Either<"LB", "RB">>

// $ExpectType 0 | Option.Option<string | number> | Either.Either<"LA" | "LB", "RA" | "RB">
declare const both: Unify.Unify<Either.Either<"LA", "RA"> | Either.Either<"LB", "RB"> | Option.Option<number> | Option.Option<string> | 0>
// $ExpectType 0 | Option<string | number> | Either<"LA" | "LB", "RA" | "RB">
type both = Unify.Unify<Either.Either<"LA", "RA"> | Either.Either<"LB", "RB"> | Option.Option<number> | Option.Option<string> | 0>

// $ExpectType <N>(n: N) => Either.Either<string, N>
// $ExpectType <N>(n: N) => Either<string, N>
const b = Unify.unify(<N>(n: N) => Math.random() > 0 ? Either.right(n) : Either.left("ok"))

// $ExpectType Either.Either<string, number>
// $ExpectType Either<string, number>
const c = Unify.unify(Math.random() > 0 ? Either.right(10) : Either.left("ok"))
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"stackframe": "^1.3.4",
"ts-codemod": "^4.0.4",
"ts-node": "^10.9.1",
"typescript": "^5.0.0",
"typescript": "^5.0.4",
"ultra-runner": "^3.10.5",
"vite": "^4.2.1",
"vitest": "0.29.8"
Expand Down
94 changes: 47 additions & 47 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d04aecc

Please sign in to comment.