-
-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve DateTime type preservation (#4255)
Co-authored-by: Tim <[email protected]>
- Loading branch information
Showing
4 changed files
with
187 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"effect": patch | ||
--- | ||
|
||
Improve DateTime type preservation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import * as DateTime from "effect/DateTime" | ||
|
||
declare const utc: DateTime.Utc | ||
declare const zoned: DateTime.Zoned | ||
declare const any: DateTime.DateTime | ||
|
||
// ------------------------------------------------------------------------------------- | ||
// min | ||
// ------------------------------------------------------------------------------------- | ||
|
||
// $ExpectType Utc | Zoned | ||
DateTime.min(utc, zoned) | ||
|
||
// $ExpectType Utc | ||
DateTime.min(utc, utc) | ||
|
||
// $ExpectType Zoned | ||
DateTime.min(zoned, zoned) | ||
|
||
// $ExpectType DateTime | ||
DateTime.min(any, zoned) | ||
|
||
// $ExpectType DateTime | ||
DateTime.min(any, utc) | ||
|
||
// $ExpectType DateTime | ||
DateTime.min(any, any) | ||
|
||
// $ExpectType Utc | Zoned | ||
utc.pipe(DateTime.min(zoned)) | ||
|
||
// $ExpectType Utc | Zoned | ||
zoned.pipe(DateTime.min(utc)) | ||
|
||
// $ExpectType Utc | ||
utc.pipe(DateTime.min(utc)) | ||
|
||
// $ExpectType Zoned | ||
zoned.pipe(DateTime.min(zoned)) | ||
|
||
// $ExpectType DateTime | ||
any.pipe(DateTime.min(zoned)) | ||
|
||
// $ExpectType DateTime | ||
any.pipe(DateTime.min(utc)) | ||
|
||
// $ExpectType DateTime | ||
any.pipe(DateTime.min(any)) | ||
|
||
// ------------------------------------------------------------------------------------- | ||
// max | ||
// ------------------------------------------------------------------------------------- | ||
|
||
// $ExpectType Utc | Zoned | ||
DateTime.max(utc, zoned) | ||
|
||
// $ExpectType Utc | ||
DateTime.max(utc, utc) | ||
|
||
// $ExpectType Zoned | ||
DateTime.max(zoned, zoned) | ||
|
||
// $ExpectType DateTime | ||
DateTime.max(any, zoned) | ||
|
||
// $ExpectType DateTime | ||
DateTime.max(any, utc) | ||
|
||
// $ExpectType DateTime | ||
DateTime.max(any, any) | ||
|
||
// $ExpectType Utc | Zoned | ||
utc.pipe(DateTime.max(zoned)) | ||
|
||
// $ExpectType Utc | Zoned | ||
zoned.pipe(DateTime.max(utc)) | ||
|
||
// $ExpectType Utc | ||
utc.pipe(DateTime.max(utc)) | ||
|
||
// $ExpectType Zoned | ||
zoned.pipe(DateTime.max(zoned)) | ||
|
||
// $ExpectType DateTime | ||
any.pipe(DateTime.max(zoned)) | ||
|
||
// $ExpectType DateTime | ||
any.pipe(DateTime.max(utc)) | ||
|
||
// $ExpectType DateTime | ||
any.pipe(DateTime.max(any)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.