-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: generic hkts, partial, required, onDeepUndeclaredKey (#1068)
- Loading branch information
1 parent
736feb4
commit a8e2a74
Showing
37 changed files
with
725 additions
and
276 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
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 |
---|---|---|
|
@@ -8,7 +8,3 @@ const t = type({ | |
const o = type("string") | ||
|
||
ark.Record | ||
|
||
// ("string", { | ||
// bar: "number | string" | ||
// }) |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { liftArray, type conform } from "@ark/util" | ||
import { GenericHkt } from "../generic.js" | ||
import type { SchemaModule } from "../module.js" | ||
import type { Out } from "../roots/morph.js" | ||
import { generic, schemaScope } from "../scope.js" | ||
|
||
const ArkLiftArray = generic("T")( | ||
args => args.T.or(args.T.array()).pipe(liftArray), | ||
class liftArrayHkt extends GenericHkt { | ||
declare hkt: ( | ||
args: conform<this["args"], [unknown]> | ||
) => liftArray<(typeof args)[0]> extends infer lifted ? | ||
(In: (typeof args)[0] | lifted) => Out<lifted> | ||
: never | ||
} | ||
) | ||
|
||
const arkGenericsExports = { | ||
liftArray: ArkLiftArray | ||
} | ||
|
||
export type arkGenericsExports = typeof arkGenericsExports | ||
|
||
export type arkGenerics = SchemaModule<arkGenericsExports> | ||
|
||
const $ = schemaScope(arkGenericsExports) | ||
|
||
export const arkGenerics: arkGenerics = $.export() |
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
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
Oops, something went wrong.