-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix types for valid dates and intervals
- Loading branch information
1 parent
d5dda7e
commit 619ec1a
Showing
14 changed files
with
3,528 additions
and
8,525 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 |
---|---|---|
@@ -1 +1 @@ | ||
nodejs 18.15.0 | ||
nodejs 20.10.0 |
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,25 +1,30 @@ | ||
import externals from "rollup-plugin-node-externals"; | ||
import resolve from "@rollup/plugin-node-resolve"; | ||
import commonjs from "@rollup/plugin-commonjs"; | ||
import typescript from "rollup-plugin-typescript2"; | ||
import resolve from "@rollup/plugin-node-resolve"; | ||
import typescript from "@rollup/plugin-typescript"; | ||
import externals from "rollup-plugin-node-externals"; | ||
|
||
const pkg = require("./package.json"); | ||
const plugins = [ | ||
commonjs(), | ||
resolve(), | ||
externals(), | ||
typescript({ exclude: "rollup.config.ts" }), | ||
]; | ||
|
||
export default { | ||
input: "src/index.ts", | ||
output: [ | ||
{ | ||
file: pkg.main, | ||
file: "lib/index.js", | ||
format: "cjs", | ||
sourcemap: true, | ||
exports: "named", | ||
}, | ||
{ | ||
file: pkg.module, | ||
file: "lib/index.es.js", | ||
format: "es", | ||
sourcemap: true, | ||
exports: "named", | ||
}, | ||
], | ||
plugins: [externals(), typescript(), resolve(), commonjs()], | ||
plugins, | ||
}; |
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
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
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 |
---|---|---|
@@ -1,5 +1,15 @@ | ||
import { DateTime } from "luxon"; | ||
|
||
export function isValid(date: DateTime | null | undefined): date is DateTime { | ||
export type IfValid< | ||
ThisIsValid extends boolean, | ||
ValidType, | ||
InvalidType = DefaultInvalidType, | ||
> = ThisIsValid extends true ? ValidType : InvalidType; | ||
|
||
export type DefaultInvalidType = null; | ||
|
||
export function isValid( | ||
date: DateTime | null | undefined, | ||
): date is DateTime<true> { | ||
return Boolean(date?.isValid); | ||
} |
Oops, something went wrong.