-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
44e551f
commit c40ea7c
Showing
6 changed files
with
90 additions
and
34 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
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,33 +1,9 @@ | ||
import { type } from "arktype" | ||
|
||
const _user = type({ | ||
name: "string | undefined" | ||
}) | ||
|
||
interface User extends type.infer<typeof _user> {} | ||
|
||
const user: type<User> = _user | ||
|
||
user({}).toString() | ||
import { configure } from "arktype/config" | ||
|
||
Date.now() | ||
configure({ clone: false }) | ||
|
||
const tenYearsAgo = new Date() | ||
.setFullYear(new Date().getFullYear() - 10) | ||
.valueOf() | ||
|
||
const bounded = type({ | ||
dateInTheLast10Years: `${tenYearsAgo} <= Date < ${Date.now()}` | ||
}) | ||
|
||
Date.now() //? | ||
|
||
//? | ||
|
||
type.Date.laterThan("") | ||
import { type } from "arktype" | ||
|
||
const out = bounded.assert({ | ||
dateInThePast: new Date(0), | ||
dateAfter2000: new Date(), | ||
dateAtOrAfter1970: new Date(0) | ||
const userForm = type({ | ||
age: "string.numeric.parse" | ||
}) |
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